I decided to experiment the testing features of Angular. I have an app already so I just ran ng test
and instantly it has errors that I don't understand. This is my first time running angular testing.
Here is the output:
AppComponent should create the app
Failed: Template parse errors:
Can't bind to 'routerLink' since it isn't a known property of 'button'. ("<mat-toolbar color="primary">
<mat-toolbar-row>
<button mat-button [ERROR ->][routerLink]="'/'"></button>
<button mat-button (click)="login()" *ngIf="!user">Logi"): ng:///DynamicTestModule/AppComponent.html@2:27
'mat-toolbar-row' is not a known element:
1. If 'mat-toolbar-row' is an Angular component, then verify that it is part of this module.
2. If 'mat-toolbar-row' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("<mat-toolbar color="primary">
Here is the HTML snippet in app.component.html
:
<button mat-button [routerLink]="[ ... ]"></button>
And I definitely imported RouterModule
into app.module.ts
:
@NgModule({
declarations: [
...
],
imports: [
RouterModule.forRoot(routes),
...
],
...
})
export class AppModule {}
Aucun commentaire:
Enregistrer un commentaire