角度错误:未捕获(承诺):错误:模板解析错误:由于它不是'input'的已知属性,因此无法绑定到'ngModel'

时间:2019-01-11 06:16:13

标签: angular typescript

实际上,我在做这样的角度练习(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

0 个答案:

没有答案