New Component (Auto create with AngularCLI)
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
// Components
import { AppComponent } from './app.component'; // Root
import { ServersComponent } from './servers/servers.component'; // New Component
@NgModule({
declarations: [
AppComponent, // Root
ServersComponent // New Component
],
imports: [
BrowserModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
ng generate component COMPONENT_NAME
# shortcut
ng g c COMPONENT_NAME
# Using the CLI will auto populate [app.module.ts]
---------------------------------------
# NOTE: For new component within another component...
# 'recipe-list' component within 'recipe' component
ng g c recipes/recipe-list