0

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?

Paolo B
  • 3,026
  • 5
  • 21
  • 43

1 Answers1

1

you can use ternary operator

<a  ng-href="{{org && org.id==4162 ? 'https://www.org1.com/':'https://www.org2.com/' }} ">Org Link</a>
Chellappan வ
  • 23,645
  • 3
  • 29
  • 60