Let's say that I want to reference angularjs from a CDN but I would also like a fallback in case the call to the CDN fails, e.g. pointing to a local js-file. When it comes to JQuery I have seen examples where you would do something like this in javascript:
if(typeof jQuery == 'undefined') {
....
}
Is there anything similar for angularjs I can do?
If you get the message Object {version: Object, callbacks: Object} , angular is loaded. If you get the message Uncaught ReferenceError: angular is not defined , angular is not loaded.
Simply check the production variable present in the environment file, it will be true for production mode and false for development. Show activity on this post. import { platformBrowserDynamic } from '@angular/platform-browser-dynamic' import { enableProdMode } from '@angular/core'; import { AppModule } from './app.
if(typeof angular == 'undefined') {
....
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With