使用 angular 模板两次,当更新与其中一个绑定的数据时,它正在更新 other.as
Using a angular template twice and when updating the data binded with on one, it's updating the other.as well
我使用相同的 angular 模板两次(一次作为弹出窗口,第二次从弹出窗口称为基础的地方),并且我有一个复选框输入,它与布尔值绑定属性 的模型 class。
因此,无论何时在弹出窗口中进行更新,相同的更改都会反映在基本模板中。
如何让两个模型数据彼此分开。
<input type="checkbox" style="zoom: 1.3;" value="{model.ID}}"
[(ngModel)]="model.isSelected" (change)="responseSelection(multipleChoiceOption)" />
<label>{{model.optionName}}</label>
相同的 angular 模板两次 - 我猜你在 html 中使用了相同的组件两次??
和您正在使用的模型 {ID, isSelected, optionName} 对象,如果它在两个 templates/components 上是同一个对象,它将同时在两个地方更新.. 请确保模型对象两个模板都不同..
我使用相同的 angular 模板两次(一次作为弹出窗口,第二次从弹出窗口称为基础的地方),并且我有一个复选框输入,它与布尔值绑定属性 的模型 class。
因此,无论何时在弹出窗口中进行更新,相同的更改都会反映在基本模板中。
如何让两个模型数据彼此分开。
<input type="checkbox" style="zoom: 1.3;" value="{model.ID}}"
[(ngModel)]="model.isSelected" (change)="responseSelection(multipleChoiceOption)" />
<label>{{model.optionName}}</label>
相同的 angular 模板两次 - 我猜你在 html 中使用了相同的组件两次??
和您正在使用的模型 {ID, isSelected, optionName} 对象,如果它在两个 templates/components 上是同一个对象,它将同时在两个地方更新.. 请确保模型对象两个模板都不同..