Gobinath M
Gobinath M

Reputation: 2021

How to change the Link path value Using angular

We have a JSON data provides below link.

https://www-quicker.cna.com/profiles/html/profileView.do?userid=qui9090

But we need to change the link as we mention below,

https://www-quicker.cna.com/profiles/photo.do?userid=qui9090

I need to change "/html/profileView.do?" insead of "/photo.do?"

We try with filters i cant find any good method.

HTML :

  <div ng-repeat="x in todos.records">
     <p>{{x.Name | ifLink}}</p>
  </div>

Upvotes: 0

Views: 47

Answers (1)

Huy Chau
Huy Chau

Reputation: 2240

Don't need filter in this case, update HTML to:

<div ng-repeat="x in todos.records">
  <p>
   {{(x.Name === '/photo.do?') ? '/html/profileView.do?' : x.Name}}
  </p>
</div>

For a tag with href attribute:

<div ng-repeat="x in todos.records">
    <a href="{{(x.Name === '/photo.do?') ? '/html/profileView.do?' : x.Name}}">Photo</a>
</div>

Note: Name is property with url value.

Upvotes: 0

Related Questions