Reference and routes

Open the quiz-edit.component.html template file and implement the ResultListComponent as a sub-component in the following way, right after the <question-list> element (new line highlighted):

[...]

<question-list *ngIf="editMode" [quiz]="quiz"></question-list>

<result-list *ngIf="editMode" [quiz]="quiz"></result-list>

[...]

Right after that, open the app.module.shared.ts file and add the usual import references, declarations, and routes:

[...]

import { AnswerEditComponent } from './components/answer/answer-edit.component';
import { ResultListComponent } from './components/result/result-list.component';
import { ResultEditComponent } from './components/result/result-edit.component';
import { AboutComponent } from './components/about/about.component';

[...]

declarations: [

[...]

AnswerEditComponent,
ResultListComponent,
ResultEditComponent,
AboutComponent,

[...]

RouterModule.forRoot([

[...]

{ path: 'answer/edit/:id', component: AnswerEditComponent
},
{ path: 'result/create/:id', component: ResultEditComponent
},

{ path: 'result/edit/:id', component: ResultEditComponent
},

{ path: 'about', component: AboutComponent },

[...]

As we can see, we also took the chance to add the references and routes for the upcoming ResultEditComponent, which is coming in the next paragraph.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.12.136.119