0

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 === '/photo.do?') ? '/html/profileView.do?' : x.Name}}
  </p>
  </div>

1 Answer 1

1

Use a function to do a JavaScript string replace:

Angular:

$scope.replace = function(string) {
    string = string.replace("/html/profileView.do?", "/photo.do?");
    return string;
}

HTML:

<p>
    {{replace(x.Name)}}
</p>

Fiddle: http://jsfiddle.net/Lvc0u55v/5808/

Edit the object structure to best suit your application, this is only an example.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.