I'm new to angular 2, I saw some videos and implement this but I am facing some problems.
I have created a new component navbar and imported it in app.component.ts
file. While adding meta data @Component directive not found error occurred.
Error: Argument of type '{ selector: string; template: string; directive: (typeof NavbarComponent)[]; }' is not assignable to parameter of type 'Component'.
Object literal may only specify known properties, and 'directive' does not exist in type 'Component'.
app.component.ts Code:
import { Component } from '@angular/core';
import { NavbarComponent } from './navbar.component';
@Component({
selector: 'my-app',
template: `<h1>Hello {{name}}</h1>`,
directive: [NavbarComponent]
})
export class AppComponent { name = 'Angular'; }
Hello {{name}}
`. Remove `directive: [NavbarComponent]` from component decorator and try. – Amit Chigadani May 11 '18 at 04:39