Yamen Nassif
Yamen Nassif

Reputation: 2486

JS file is loaded but not being executed

I have a project running on Symfony with angular js and its all working good except for a strange thing.

I added a JavaScript file to execute some JQuery functions i already tested in the browser console and they are all working good with no errors the problem is when I inspect element i can see the file being called in the head and i can also see it in the sources I can even open the link and see the file. But for some reason the functions in there are not being called executed.

following the images to prove that its loading with no errors.

Edit: Its not about putting the code in ready function or not

file accessed from browser

in head

in sources

no errors

Upvotes: 3

Views: 2231

Answers (2)

Imran Bughio
Imran Bughio

Reputation: 4941

My script file was also loading but not executing but I had a different issue, basically avoid using href attribute in script tag and instead use src

Upvotes: 0

Mohit Tanwani
Mohit Tanwani

Reputation: 6628

$(document).ready is firing before angular has loaded the content onto the page.

So it might be the possibility of your jQuery plugin calls before your Angular loads the content onto the page.

what you need to do is somehow, call your jQuery plugin once your Angular gets init or you can turns your code into directive.

Upvotes: 1

Related Questions