Search code examples
javascriptangularjscloud9-ide

Angular suddenly requires rewrite of img source to relative path


For the last three weeks I had my Angular website working with ui-router and states.

Thus a state looks as follows:

.state('home', {
    url: '/home',
    templateUrl: '/templates/home.html',
    controller:'HomeCtrl as home',
  })

In the file home.html, the way I added an image was by simply pointing to the img folder as follows:

<img src="img/boo.png">

This worked all the time fine.

Now however, when I tried to run the page in my Cloud9, it said that it cannot find boo.png. However when I write:

<img src="../img/boo.png">

Then it works fine.

What could have happened that this sudden rewrite is needed?


Solution

  • I solved it by rewriting all

    <img src="..">
    

    to:

    <img ng-src="..">
    

    Don't know what happened, but it works fine now.