Switching between development and production modes

Angular applications are bootstrapped and initialized by default in development mode. In the development mode, the Angular runtime will throw warning messages and assertions to the browser console. While this is quite useful for debugging our application, we do not want those messages to be displayed when the application is in production. The good news is that the development mode can be disabled in favor of the more silent production mode. This action is usually performed before bootstrapping our application:

import { environment } from './environments/environment';
// other imports omitted for brevity
if(environment.production) {
enableProdMode();
}

//bootstrap
platformBrowserDynamic().bootstrapModule(AppModule);

What we can see here is that the call to enableProdMode() is what enables production mode.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset