Found a solution myself: 

   1. 
   
   Get the current base url thanks to the Location object:
   
   var base_url = location.protocol + "//" + location.hostname + 
location.pathname;
   
   2. 
   
   Give it as a base path to my image in my controller: 
   
   imgBig: base_url + 'img/' + $scope.imgBig
   
   
That way, *unsafe:* disappeared, it works on every browsers and it's 
independent from a constant base path.

Hope it can help !

Le dimanche 16 février 2014 22:24:06 UTC+1, Surreal a écrit :
>
> Hi,
>
> I just wanted to add an image to my app.
> As advised, I used the ng-src directive: 
> <img ng-src="{{app.imgBig}}" alt="lorem ipsum" height="100" width="200" 
> title="lorem ipsum" />
>
> It works fine on most browsers but it doesn't on ie8.
> The image is not loaded as instead of adding the absolute url to the file 
> name, it returns the relative and adds "unsafe:" before it.
>
> Actually, it's trying to load:
> unsafe:img/test.jpg
> Instead of:
> http://mysite.com/img/test.jpg
>
> So you know, it may be related to the fact I had to completely disable SCE 
> to support IE7: 
> $sceProvider.enabled(false);
>
> A quick fix was to include the base url as a constant and add it at the 
> beginning of the image path but it's not the best as the app should be 
> dependent from this base path.
>
> Any idea ?
>

-- 
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/groups/opt_out.

Reply via email to