Posts

Showing posts with the label Bootstrapping in Angular

Angular Configuration

Image
In Previous topic we have seen about Angular Observable , in this topic we will look into configuration part of our angular application.  When an application starts it need some sort of runtime configuration information like UR endpoint etc.   APP_INITIALIZER ➤➤➤ APP_INITIALIZER is a dependency injection token that you can use to provide one or more initialization functions. The provided functions are injected at application startup and executed during app initialization. If any of these function returns a Promise or Observable, initialization does not complete until the promise is resolved or Observable is completed.  We will look into an example in which we will get some results, these results usually returned as an observable or a promise which matches exactly with the signature of APP_INITIALIZER function. So to use this service we do not need to create any new instance like Service service = new Service(); Angular will handle these through dependency injection, we ...

Bootstrap in Angular

Image
Angular Components   In this topic we will look how Angular work internally and bootstrap application. When you create a new angular project using ng new 'project Name' it will generate many files like shown below: checkout  Angular Application with Angular CLI  for more...   What is Bootstrapping ? Bootstrapping is a technique of loading or initializing our angular application. Angular takes following steps to our first view. 1. Index.html gets loaded. 2. Libraries gets loaded. 3. Main.ts entry point for application. 4. Root Module. 5. Root Component. 6. Templates. Index.html Index.html is the first page to load, you can find index.html under src folder src → index.html.  you can see index.html does not contain any javascript or stylesheet file, it only contain html tag  <app-root></app-root> inside body. index.html will look as shown below: <!doctype html > <html lang = "en" > <head>   <meta charset = "u...