Given the following components. I want to use these components on a non SPA web site exactly like the plunker here. This sample is no longer valid, as the latest beta of angular
The answer to anyone else attempting this, is to create two modules, and register each module separately
Registration
//main entry point
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import {AppModuleA, AppModuleB} from './app';
platformBrowserDynamic().bootstrapModule(AppModuleA);
platformBrowserDynamic().bootstrapModule(AppModuleB);
Modules
@NgModule({
imports: [ BrowserModule ],
declarations: [ AppA ],
bootstrap: [ AppA ]
})
export class AppModuleA {}
@NgModule({
imports: [ BrowserModule ],
declarations: [ AppB ],
bootstrap: [ AppB ]
})
export class AppModuleB {}
Seems you are missing a module definition e.g.:
app.module.ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import {Comp1} from './comp1';
import {Comp2} from './comp2';
@NgModule({
imports: [
BrowserModule
],
declarations: [
Comp1,
Comp2
],
bootstrap: [Comp1]
})
export class AppModule { }
main.ts
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';
platformBrowserDynamic().bootstrapModule(AppModule);