Getting into Angular and watching an outdated tutorial which is in fact for Angular2 (y, I know).
Angular4:
@NgModule({
imports: [ BrowserModule ],
declarations: [ AppComponent , MyChildComponent ],
bootstrap: [ AppComponent ]
})
Seems that this is how you nest components now but isn't there a way to do it how it was done (or similarly) in Angular 2? As in you could import it in the now-deprecated 'directives' property DIRECTLY IN YOUR ROOT COMPONENT (found this really convenient for fast development).
Angular2:
@Component({
selector: 'app-root',
directives: [MyChildComponent]
template: '<div><ChildComponent></ChildComponent></div>'
})
export class AppComponent {}
Edit: Here's the MyChildComponent declaration (still part of Angular2):
@Component({
selector: 'ChildComponent',
template: '<h2>Child component</h2>'
})
export class MyChildComponent {}
Note: Omitted the import declarations