实际上,我在做这样的角度练习(https://stackblitz.com/edit/angular-cjmsgg),它通过使用stackblitz起作用,但是当我使用自己的角度时,它无法显示
控制台错误:
ERROR Error: Uncaught (in promise): Error: Template parse errors:
Can't bind to 'ngModel' since it isn't a known property of 'input'. ("
<p>
WidthLength : <input type="number" min="1" step="5"
[ERROR ->][(ngModel)]="widthLength" (change)="showPic()" ><br>
HeightLength : <input type="number" min="1" st"): ng:///P3Module/P3Component.html@10:16
component.html
<p>
WidthLength : <input type="number" min="1" step="5"
[(ngModel)]="widthLength" (change)="showPic()" ><br>
HeightLength : <input type="number" min="1" step="5"
[(ngModel)]="heightLength" (change)="showPic()"><br>
<img [src]='imageUrl '/>
</p>
<router-outlet></router-outlet>
component.ts