我有一个Angular 8
应用程序。
app.component.html
<div>
<label class="form-check-label f-14">
<input type="checkbox" class="form-check-input" name="isAgree" [(ngModel)]="isAgree" #isAgree="ngModel"/> Agree?
</label>
</div>
但这是抛出错误。
compiler.js:7627 未捕获的错误:无法分配给引用或变量!在 _AstToIrVisitor.visitPropertyWrite (compiler.js:7627)
我想了解这个错误定义和原因。我怎样才能摆脱这个?
另外,我不想在我的app.component.ts
. 我需要访问isAgree
视图中的标志值。所以理想情况下我正在尝试如下。
<div>
<label class="form-check-label f-14">
<input type="checkbox" class="form-check-input" name="isAgree" #isAgree/> Agree?
</label>
<p> {{isAgree}} </p>
</div>
但价值并没有体现出来。
我怎样才能以这种方式获得价值?
我知道我正在结合 2 个问题,但两者似乎都非常相关。因此就这样做了。
谢谢!