I have snippet of a view. vm.items is an object, each item of object contains an email or phone and the code correspondingly. For example {value:'123456', code: 'phone'}.
.contacts
.contact(ng-repeat='item in vm.items track by $index')
span {{item | phone}}
The question is how could i apply filter only when item is a phone. It means the code of item is phone, and when it is an email leave it as is. I thought i could use ternary operator and have something like this: span {{item | item.code === "phone"? phone : '' }}, but i didn't succeed. I cannot change the phone filter code and pass any parameters to this filter. I cannot create new filter for email.
span {{item | item.code === "phone"? phone : '' }}?angular.js:14700 Error: [$parse:syntax] Syntax Error: Token '.' is an unexpected token at column 12 of the expression [item | item.code === "phone"? phone : ''] starting at [.code === "phone"? phone : ''].{{ item.code === "phone" ? (item | phone) : item }}