Create Book List Component
We need to generate a component for our application. In our console, navigate to the book management folder that we have created earlier. Your path should look similar to:
/smuportal-frontend/src/app/applications/book-management-system
Once reached, we are ready to create our component. Angular allows us to generate a component with a simple command:
ng generate component list-books
We only need to define our component in the module we created. Your book management system module should become the following:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule, Routes } from "@angular/router";
import { ListBooksComponent } from './list-books/list-books.component';
const routes: Routes = [
{
path: "list",
component: ListBooksComponent
},
];
@NgModule({
declarations: [],
declarations: [ListBooksComponent],
imports: [
CommonModule
]
})
export class BookManagementSystemModule { }
Finally, we create a new file "index.ts" in the list-books folder and add the following line:
export * from "./list-books.component"
Last updated
Was this helpful?