Angular 2 multiple components -


it seemed confused angular 2 concept. i'd have 3 components on page defined way in app.component.html (this should entry point):

<bp-header></bp-header> <bp-home></bp-home> <bp-footer></bp-footer> 

and main component (app.component.ts):

import { component }          '@angular/core'; import { router_directives }  '@angular/router'; import {headercomponent} "./header.component" import {footercomponent} "./footer.component" import {homecomponent} "./home.component" @component({   selector: 'bp-app',   templateurl: 'app.component.html',   styleurls: ['app/app.component.css'],   directives: [headercomponent, footercomponent, homecomponent] }) export class appcomponent {} 

bu there nothing when open home page no errors in console.

well, final solution put header , footer directives inside template way bp-header , bp-footer separate components.

import { component }          '@angular/core'; import { router_directives }  '@angular/router'; import {headercomponent} "./header.component" import {footercomponent} "./footer.component" import {homecomponent} "./home.component" @component({   selector: 'bp-app',   templat: '<bp-header></bp-header><bp-footer></bp-footer>',   styleurls: ['app/app.component.css'],   directives: [headercomponent, footercomponent, homecomponent] }) export class appcomponent {} 

Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -