如何使用ng-bind模型
How to use ng-bind for my model?
从文档中,很明显,使用ng-bind我们可以更新我们的HTML,如何使用相同的功能来更新我的模型。
<input type="text" ng-bind="controller.model.property">
我不想使用ng-model,当从后端获取数据时,不想在输入框中反映更改
如果您不想要双向数据绑定,我假设您将一次处理所有数据(可能在单击按钮时)。我要做的是创建一个临时作用域变量,使用ng-model进行赋值,然后在按钮单击时将其赋值给原始变量。
//template
<input type="text" ng-model="temp.property">
<button ng-click="submit()">Save</button>
//controller
$scope.model = updateViaBackend();
$scope.temp = { property: "" };
$scope.submit = function(){
$scope.model.property = $scope.temp.property;
}
相关文章:
- 显示&作为&在jsp中使用angularjs而不使用ng-bind-html
- Angular 1.4解析ng-bind-html的内容
- ng-bind-html 工作,但抛出错误
- AngularJS: ng-bind-html remove styling
- 为什么我的指令是't使用ng-bind-html指令
- 在Angular中,在类中使用ng-bind
- ng-bind-html在点击锚标记或ng-click之前不显示
- AngularJS:如何将视图中指定的模型(ng-bind)绑定到通过API可用的$资源
- angular ng show/ng hide无法正确使用ng bind html
- ng-bind-html中的angular命令
- Angular 和 django 无法加载 ng-bind
- 如何使用$scope和ng-bind在AngularJS中检索文本框条目
- Angular ng-bind-html - 阻止执行JS代码
- ng-bind 在 AngularJs 中的 ng-dialog 上不起作用
- ng-repeat / ng-bind 不会显示我的数据
- 如何使ng-bind-html编译angularjs代码
- Angularjs 和 ng-bind-html 无法正常工作
- ng-bind 用作文本区域的指令,但不是输入标签
- Angularjs selectbox 在使用 ng-bind-html 时不反映底层 ng-model
- 如何使用ng-bind模型