How can I check whether there is a Angular.js script loaded on page?
Asked
Active
Viewed 2,706 times
0
-
`if(angular){}`, assuming the variable isn't used by something else. – Cerbrus Aug 21 '15 at 07:31
-
1check this link : http://stackoverflow.com/questions/19742191/how-to-check-if-angular-is-loaded-correctly – bob Aug 21 '15 at 07:33
-
Just i try to check, if the CDN is working properly in my project. I'm using mike and cebrus answer , it is working fine. – vinodh Aug 21 '15 at 07:36
1 Answers
0
You can check by doing this
if (window['angular']) {
// Angular is loaded and available to use
}

Mike Vranckx
- 5,557
- 3
- 25
- 28
-
-
Executing your code throws a `Uncaught ReferenceError: angular is not defined` exception. When checking on window object, it verifies if `angular` property exists or not. If it does not exist, it will not throw an exception. – Mike Vranckx Aug 21 '15 at 07:37
-