I am trying to allow users to add ratings to the books they have read. I am using "@angular/material": "^7.3.0" and "@ng-bootstrap/ng-bootstrap": "^4.0.2".
I have imported the following in my app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { ListComponent } from './components/list/list.component';
import { RegistrationComponent } from './components/registration/registration.component';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
I have added NgbModule to my imports,
imports: [
....,
NgbModule
],
I am trying to show the ratings in my list.component.html. The list.component.ts looks like this,
export class ListComponent implements OnInit {
// other code here
currentRate = 8;
}
I have imports in list.component.ts but none related to the rating implementation.
The list.component.html for the rating implementation looks like this,
<ng-container matColumnDef="rating">
<th mat-header-cell *matHeaderCellDef>Rating</th>
<td mat-cell>
<ngb-rating [(rate)]="currentRate"></ngb-rating>
<pre>Rate: <b>{{currentRate}}</b></pre>
</td>
</ng-container>
I am trying to implement this by following the Basic demo example provided at ng-bootstrap rating. The form headers are displayed but no data is shown. The error is
core.js:15714 ERROR TypeError: Cannot read property 'template' of undefined
It has something to do with the rating implementation i am attempting as the form was working fine previously. Thank you in advance.
list.component.htmlfile? Looks like it's been shortened. - Edric