user2062455
user2062455

Reputation: 421

angular ui-sref params not equal

I have this code:

<a ui-sref="contacts({ type: contact.type })">Joe</a>

Which says "get the contacts that type = contact.type. So in the url I would pass a param contacts/friends and it would give me a list of contacts with type "friends"

is there any way that I can say this: "get the contacts that type != contact.type"

meaning, if i pass a param contacts/friends to show results with all contacts that do not have type "friends"

I've tried several variations of this:

<a ui-sref="contacts({ type != contact.type })">Joe</a>

with no result.

does anyone know if that's possible?

Upvotes: 0

Views: 104

Answers (2)

Kobi Cohen
Kobi Cohen

Reputation: 678

Params are there to pass data, not to do database query.

If you want to get all contacts that are not of type A, make a REST request/DB query or whatever way you use to fetch data, and use the recieved 'type' param as part of it. for example:

SELECT * FROM contacts where Type != {type}

Upvotes: 0

Venkat
Venkat

Reputation: 1145

ui-sref should not be used to pass params to the state. use stateParams to do this.

Upvotes: 0

Related Questions