Skip to content Skip to sidebar Skip to footer

Using Ng-attr-href From Angular To Direct User Interaction

So what I am trying to do is for an icon (link), the user will have already logged on and there is a property identified that is true or false. Based on whether that property is tr

Solution 1:

Can use a ternary within a {{}} expression in ng-href

<ang-href="{{object.value ? 'somepage.html' : 'otherpage.html'}}">

Solution 2:

Put a function inside your controller to provide the value, then call it inside the ng-href. This type of decision of which link to go is the controller's responsibility.

ng-href="whereToGo(object.value)"

Post a Comment for "Using Ng-attr-href From Angular To Direct User Interaction"