Angular 角度4*ngIf-模型变量更改时动态显示/隐藏

Angular 角度4*ngIf-模型变量更改时动态显示/隐藏,angular,Angular,这已经被问了好几次了,但是其他的例子似乎比我的简单用例要复杂一些 我试图根据选择框的值显示/隐藏textarea 它在加载时按预期工作,但在来回更改select的值时不起作用 正如我所说,模型变量的默认值是false,并且textarea在加载时隐藏(根据需要) 以下是HTML: <div> <select id="isFunded" [(ngModel)]="isFunded" name="isFundedSelect"> <option

这已经被问了好几次了,但是其他的例子似乎比我的简单用例要复杂一些

我试图根据选择框的值显示/隐藏
textarea

它在加载时按预期工作,但在来回更改select的值时不起作用

正如我所说,模型变量的默认值是
false
,并且
textarea
在加载时隐藏(根据需要)

以下是HTML:

<div>
    <select id="isFunded" [(ngModel)]="isFunded" name="isFundedSelect">
        <option value="false" selected>No</option>
        <option value="true">Yes</option>
    </select>
</div>
<div>
    <textarea class="form-control" rows="3" placeholder="Notes..." *ngIf="isFunded"></textarea>
</div>
<p>Is funded? {{isFunded}}</p> <!-- this updates when the select value changes -->
在更改为
false
然后返回到
true
后,如何重新隐藏
textarea

如果是相关的,我有一个从angular CLI生成的项目,这些是我的应用程序模块中的导入:
BrowserModule、FormsModule、CommonModule


谢谢

试着用[ngValue]='true'代替value。

试着用[ngValue]='true'代替value。

就是这样。非常感谢。成功了。非常感谢。
import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-second-form',
  templateUrl: './second-form.component.html',
  styleUrls: ['./second-form.component.sass']
})
export class SecondFormComponent implements OnInit {
  isFunded = false;
  constructor() { }
  ngOnInit() {
  }
}