Create Main Component

In this part, we create a new component which will be the main page for our app. We start by checking in our console that we are in the correct directory:

/smuportal-frontend/src/app/applications/book-management-system

We generate our component by typing in the console:

ng generate component bms-main-page

Now we need to make sure that our book management system module is updated:

import { CommonModule } from '@angular/common';
import { RouterModule, Routes } from "@angular/router";
import { ListBooksComponent } from './list-books/list-books.component';
import { BmsMainPageComponent } from './bms-main-page/bms-main-page.component';

const routes: Routes = [
  {
    path: "",
    component: BmsMainPageComponent
  },
  {
    path: "list",
    component: ListBooksComponent
  },
];

@NgModule({
  declarations: [ListBooksComponent, BmsMainPageComponent],
  imports: [
    CommonModule,
    RouterModule.forChild(routes),
  ],
  exports: [RouterModule]
})
export class BookManagementSystemModule { }

Finally, in our book management folder, we create a new file "index.ts" and add the following lines:

export * from "./list-books"
export * from "./bms-main-page"

Last updated