Reputation: 3354
I can change properties in AngularJS by using a conditional If statement:
OrgName: org && org.id==4162 ? 'Org1' : 'Org2'
But i want to be able to change the href
of a link depending on this value. How can I accomplish this? I have tried:
<a org && org.id==4162 ? ng-href=https://www.org1.com/ : ng-href=https://www.org2.com/>Org Link</a>
Any help appreciated?
Upvotes: 0
Views: 31
Reputation: 27293
you can use ternary operator
<a ng-href="{{org && org.id==4162 ? 'https://www.org1.com/':'https://www.org2.com/' }} ">Org Link</a>
Upvotes: 1