In AngularJs 1 there were two ways of bootstrapping your module.
- Automatic by ng-app
- Manual bootstrap by code
But now when I started exploring Angular 2 I can find only one way of bootstraping it (through code).When I investigated more I found that this has been restricted because of security reasons, as well as architectural changes.
You instantiate an Angular application by explicitly specifying a component to use as the root component for your application via the bootstrap() method. An application is bootstrapped inside an existing browser DOM, typically index.html. Unlike Angular 1, Angular 2 does not compile/process providers in index.html. This is mainly for security reasons, as well as architectural changes in Angular 2. This means that index.html can safely be processed using server-side technologies such as providers.
Note: Found above statement from platform_browser_dynamic.js
Questions:
- What security reasons were there to remove automatic bootstrapping.
- What problems automatic bootstrapping was creating for server side rendering.