0
私は現在、click
とngIf*
を使用していますが、ダブルクリックすると変更が行われます。また、現在選択されているオプションをダブルクリックすると、ビューが変更され、そのようなことは起こりたくありません。どのようにこれを正しく行うことができますか?角2+を使用してラジオボタンをチェックしたときに要素を非表示にする方法は?
<fieldset class="form-group col-md-3">
<div class="form-check">
<label class="form-check-label">
<input (click)="computation = !computation" type="radio" class="form-check-input" name="optionsRadios" id="optionsRadios1" value="option1" checked>
Enable View
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input (click)="computation = !computation" type="radio" class="form-check-input" name="optionsRadios" id="optionsRadios2" value="option2">
Disable View
</label>
</div>
</fieldset>
<div *ngIf="computation" class="form-group col-md-3">
<label for="app_id_org_input">Enabled</label>
<input type="text" class="form-control" id="app_id_org_input" placeholder="Enabled">
</div>
<div *ngIf="!computation" class="form-group col-md-3">
<label for="app_id_input">Disabled</label>
<input type="text" class="form-control" id="app_id_input" placeholder="Disabled">
</div>
私はどこ私は変数の計算を宣言すべきかわかりません。このエラーはそれと関係がありますか? 'ngModel'は 'input'の既知のプロパティではないため、バインドできません。 – user3235483
まずFormsModuleをモジュールにインポートする必要があります。次に、コンポーネントクラスで計算を宣言します。私はあなたがすでに宣言した、または元のものが動作しないと思います。 –