0

I have a tag with the following things:

<img src="https://abc.com/abc.png" height="300" width="300">

I'm calling a REST API. After calling REST API, I get the values of src, height and width. How can I pass from controller to view in angularjs?

1 Answer 1

1

Yes.

To controll the src you need to use ngSrc directive:

<img ng-src="http://www.gravatar.com/avatar/{{hash}}"/>

To controll the style use ngStyle directive:

$scope.myStyle = {"width":"500px", "height":"500px"};

<img ng-style="myStyle"/>
Sign up to request clarification or add additional context in comments.

4 Comments

How about height and width?
I meant height and width for <img> tag
Want to solve another issue: stackoverflow.com/questions/27426958/…

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.