EDIT: according to answers I edited app.module.ts and added <router-outlet></router-outlet> to app.component.html.
app.module.ts:
import { AppComponent } from './app.component'; import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import {Routes, RouterModule} from "@angular/router"; import { AdminComponent } from './Admin/admin.component'; import { MainpageComponent } from './Mainpage/mainpage.component'; const appRoutes: Routes = [ {path: 'admin', component: AdminComponent}, {path: '', component: MainpageComponent} ]; @NgModule({ declarations: [ MainpageComponent, AdminComponent, AppComponent ], imports: [ BrowserModule, RouterModule.forRoot( appRoutes, {enableTracing: true} ) ], providers: [], bootstrap: [AppComponent] }) export class AppModule { } Now i see these errors:
compiler.js:485 Uncaught Error: Template parse errors: 'app-header' is not a known element: 1. If 'app-header' is an Angular component, then verify that it is part of this module. 2. If 'app-header' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("[ERROR ->]<app-header></app-header> <div class="container"> <div class="row"> "): ng:///AppModule/MainpageComponent.html@0:0 'app-sidebar' is not a known element: 1. If 'app-sidebar' is an Angular component, then verify that it is part of this module. 2. If 'app-sidebar' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. (" <div class="row"> <div class="col-lg-3"> [ERROR ->]<app-sidebar></app-sidebar> </div> <div class="col-lg-9"> "): ng:///AppModule/MainpageComponent.html@4:10 'app-carousel' is not a known element: 1. If 'app-carousel' is an Angular component, then verify that it is part of this module. 2. If 'app-carousel' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. (" </div> <div class="col-lg-9"> [ERROR ->]<app-carousel></app-carousel> <app-bottompanel></app-bottompanel> </div> "): ng:///AppModule/MainpageComponent.html@7:8 'app-bottompanel' is not a known element: 1. If 'app-bottompanel' is an Angular component, then verify that it is part of this module. 2. If 'app-bottompanel' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. (" <div class="col-lg-9"> <app-carousel></app-carousel> [ERROR ->]<app-bottompanel></app-bottompanel> </div> </div> "): ng:///AppModule/MainpageComponent.html@8:8 'app-footer' is not a known element: 1. If 'app-footer' is an Angular component, then verify that it is part of this module. 2. If 'app-footer' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. (" </div> </div> [ERROR ->]<app-footer></app-footer> "): ng:///AppModule/MainpageComponent.html@12:0 at syntaxError (compiler.js:485) at TemplateParser.parse (compiler.js:24668) at JitCompiler._parseTemplate (compiler.js:34621) at JitCompiler._compileTemplate (compiler.js:34596) at eval (compiler.js:34497) at Set.forEach (<anonymous>) at JitCompiler._compileComponents (compiler.js:34497) at eval (compiler.js:34367) at Object.then (compiler.js:474) at JitCompiler._compileModuleAndComponents (compiler.js:34366) This is how my structure looks like:
