user4739287
user4739287

Reputation:

'directive' does not exist in type 'Component'

Two components and terminal error picture

Basically there are two components, app component and courses component. I wanna use courses component in app component as you can see in the picture. But it's giving me the error visible in terminal.

Upvotes: 3

Views: 2265

Answers (1)

Sanket
Sanket

Reputation: 20037

The directives are not available in 2.0.0-rc.6 onwards. You will have to add it in declarations of AppModule like this-

import { CoursesComponent }               from './courses.component';

@NgModule({
    imports:      [ BrowserModule, routing, RouterModule ],
    declarations: [ AppComponent, CoursesComponent ],
    providers:    [ appRoutingProviders ],
    bootstrap:    [ AppComponent ]
})

Upvotes: 4

Related Questions