> Back to Module Updates
> Angular 6 Samples
Shopping list feature module follows the same rules as Recipes Module. Since the Shopping list doesn't have the child routes, we don't need to move these into Shopping list module.
The only piece we'll be moving from app module is the components declarations.
Create a new file app.shopping-list.module.ts in src > app folder and add the following to it. Make sure to remove the shopping list components from the app module.
import { NgModule } from "../../node_modules/@angular/core";
import { CommonModule } from "../../node_modules/@angular/common";
import { FormsModule } from "../../node_modules/@angular/forms";
import { ShoppingListComponent } from './shopping-list/shopping-list.component';
import { ShoppingEditComponent } from './shopping-list/shopping-edit/shopping-edit.component';
@NgModule({
declarations: [
ShoppingListComponent,
ShoppingEditComponent
],
imports: [
CommonModule,
FormsModule
],
exports: [
FormsModule
]
})
export class ShoppingListModule{}
With the above in, add ShoppingListModule to the imports array and we should be all good.
import { ShoppingListModule } from './app.shopping-list.module'; //this has the component declarations
@NgModule({
declarations: [
...
],
imports: [
...,
ShoppingListModule, //this has the component,
...
],
providers: [...],
bootstrap: [...]
})
> Back to Module Updates
> My Recipes Angular 6 Project
> Angular Samples
> Angular 6 Samples
> Angular 6 Samples
Shopping list feature module follows the same rules as Recipes Module. Since the Shopping list doesn't have the child routes, we don't need to move these into Shopping list module.
The only piece we'll be moving from app module is the components declarations.
Create a new file app.shopping-list.module.ts in src > app folder and add the following to it. Make sure to remove the shopping list components from the app module.
import { NgModule } from "../../node_modules/@angular/core";
import { CommonModule } from "../../node_modules/@angular/common";
import { FormsModule } from "../../node_modules/@angular/forms";
import { ShoppingListComponent } from './shopping-list/shopping-list.component';
import { ShoppingEditComponent } from './shopping-list/shopping-edit/shopping-edit.component';
@NgModule({
declarations: [
ShoppingListComponent,
ShoppingEditComponent
],
imports: [
CommonModule,
FormsModule
],
exports: [
FormsModule
]
})
export class ShoppingListModule{}
With the above in, add ShoppingListModule to the imports array and we should be all good.
import { ShoppingListModule } from './app.shopping-list.module'; //this has the component declarations
@NgModule({
declarations: [
...
],
imports: [
...,
ShoppingListModule, //this has the component,
...
],
providers: [...],
bootstrap: [...]
})
> Back to Module Updates
> My Recipes Angular 6 Project
> Angular Samples
> Angular 6 Samples