Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between production and development mode in Angular2?

For some reason, I have to run my app in production mode. What is the difference between those modes?

like image 511
Rhushikesh Avatar asked Jan 19 '16 05:01

Rhushikesh


People also ask

What is the difference between production mode and development mode?

Production mode minifies your code and better represents the performance your app will have on end users' devices. Development mode includes useful warnings and gives you access to tools that make development and debugging easier.

What is the difference between production and development?

The development environment is your local computer, while the production environment is the live product customers or visitors might interact with.

What is production mode?

In the Production mode, you cannot copy your files or database to the Production environment. This protects you from possibly destroying your live application by overwriting your Production files and databases. You copy databases and files up to the Production environment only until you first launch your application.

How do I enable production mode in angular 9?

Call enableProdMode() to enable the production mode.


1 Answers

In development mode, change detection does a second run immediately after the first run and produces an error if any bound value has changed between the first and the second run. This helps to locate bugs where checking values has side-effects or fields or functions don't return the same value on subsequent calls which undermines Angular's change detection.

In development mode, during the second change detection run, Angular also does some deep object comparisons that it won't do in production to detect model changes that are disallowed.

Update:

In development mode, a hint is also printed to the console when the HTML sanitizer service strips values from bindings [innerHTML]="..." or [ngStyle]="...". See also: In RC.1 some styles can't be added using binding syntax

like image 143
Günter Zöchbauer Avatar answered Sep 20 '22 12:09

Günter Zöchbauer