ng-bind-html does not compile the html template, it just sanitizes and renders 
it. So, directives like ng-src won’t work. You might want to use ngInclude or a 
router for this functionality instead.

> On Apr 14, 2015, at 12:14 PM, Marco <[email protected]> wrote:
> 
> Hello,
> 
> in my controller i'm replacing img urls with urls i get from a database in 
> html fragments that i also get from a database
> 
> example
> 
> <div>
> <p>test</p>
> <img src="old/source/image">
> <div>
> 
> 
> 
> becomes
> 
> <div>
> <p>test</p>
> <img src="new/source/image">
> <div>
> 
> 
> the new source for the image url is constructed in the controller and a old 
> source is replaced with the new source
> 
> this did not work because of the async db operation, therefor i made a scope 
> image variable to receive the value of the src and in the html i put an 
> ng-src, so angular could bind to it
> 
> <div>
> <p>test</p>
> <img ng-src="imagevar">
> <div>
> 
> in my htm i insert the htm with ng-bind-html (using $sce on the variable)
> 
> 
> My problem is that the ng-src="imagevar" doesn't get processed, when i look 
> at the source in my browser i see <img ng-src="imagevar"> instead of the 
> source i need, when i paste the same variable in a
> 
> <div>
> {{imagevar}}
> </div>
> 
> 
> it content that needs to get in the src attribute gets displayed ok
> 
> where does this go wrong?
> 
> thanks
> 
> Marco
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "AngularJS" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at http://groups.google.com/group/angular 
> <http://groups.google.com/group/angular>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to