Html 角度2在模型更改后不更新视图

Html 角度2在模型更改后不更新视图,html,angular,Html,Angular,我的html代码中有两个ng repeat,第一个用于添加或删除列表中的元素tipo_localidad,第二个用于将一种类型的元素指定给对象 这是第一个列表的代码: <table class="table table-style"> <tr> <th>Tipo de Localidad<a href="" style="float: right"><i class="fa fa-sort-desc" aria-h

我的html代码中有两个ng repeat,第一个用于添加或删除列表中的元素
tipo_localidad
,第二个用于将一种类型的元素指定给对象

这是第一个列表的代码:

  <table class="table table-style">
    <tr>
        <th>Tipo de Localidad<a href="" style="float: right"><i class="fa fa-sort-desc" aria-hidden="true"></i></a>
        </th>
        <th>Eliminar </th>
        <th>
            <a (click)="addType('tipo destino')">
                <!-- Agregar --><i style="margin-right: 5px" class="fa fa-plus-circle fa-lg" aria-hidden="true"></i>
            </a>
        </th>
    </tr>
    <!--AngularJS  -->
    <tr *ngFor="let tipo of tipo_localidad; let n = index">
        <td>
            <input type="text" class="form-control" name="" placeholder="Tipo de localidad" [value]="tipo" (focusout)="modType(n,tipo)" />
        </td>
        <td><a (click)="deleteType(n)"><i style="margin-right: 5px" class="fa fa-times fa-lg"
                                            aria-hidden="true"></i></a>
        </td>
    </tr>
</table>

由于您没有使用
[(ngModel)]
,因此需要传递
值的值,因此:

(focusout)="modType(n, $event.target.value)"

编辑:当我在Firefox上尝试plunker时才意识到,这不起作用,所以请使用
(模糊)

(blur)="modType(n, $event.target.value)"

但是,如果您对输入值使用
[(ngModel)]
,输入值将实时更新,但这可能不是您想要做的,而是想要一个focusout/blur事件。

您也可以向我们展示添加/删除的代码吗?@rinukkusu done
(focusout)="modType(n, $event.target.value)"
(blur)="modType(n, $event.target.value)"