Angular Dual App
or more exact run separate root components.
you can just add multiple components to the bootstrap: [ decorator.
then you can run as many apps as you want.
Services?
in Angular 4 Services has scope. if we create a service at the App.Module Scope, it will share all it's info will all apps, all comps, but if you create a service, and declare it inside a providers:[ decorator, inside a specific Component, then all child components will share the same instance, but siblings comps declaring the same service will have their own instance.
you can just add multiple components to the bootstrap: [ decorator.
then you can run as many apps as you want.
bootstrap: [
AppComponent,
LoginComponent,
ContactComponent,
TableComponent,
]
<body>
<app-welcome></app-welcome>
<app-login></app-login>
<app-table></app-table>
<app-contact></app-contact>
</body>
Services?
in Angular 4 Services has scope. if we create a service at the App.Module Scope, it will share all it's info will all apps, all comps, but if you create a service, and declare it inside a providers:[ decorator, inside a specific Component, then all child components will share the same instance, but siblings comps declaring the same service will have their own instance.
Comments
Post a Comment