AngularJS ng-src in ie8: image not loaded and "unsafe" added to path -


I just wanted to add an image to my app as I have advised, I ng-SCAR instructions used to:

  & lt; Img ng-src = "{{app.imgBig}}" alt = "lorem ipsum" height = "100" width = "200" heading = "Laurem ipsum" />  

This works fine on most browsers but it is not on IE8 Image is not loaded instead of adding full url, image is loaded, it gives relative path and " Strong> Unsecured: "adds.

Actually, it is trying to load:

unsafe: img / test.jpg

instead:

So you know, it may be related to the fact that to fully support IE 7, I must fully SCE had to disable:

  $ sceProvider.enabled (false);  

To make a quick fix, to establish the base path and add it to the beginning of the image path, but this is not the best because the app should not be dependent from this base path.

Any thoughts?

found a solution in its own right:

  1. location Thanks to the current base URL for the object:

      var base_url = location.protocol + "//" + location.hostname + location.pathname;  
  2. Give it to my controller as the base path of my image:

      imgBig: base_url + 'img /' + $ Scope.imgBig  

In this way, unsafe: disappeared, it works on every browser and it's continuous The base is independent of the path.

Hope it can help!


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -