【发布时间】:2015-12-28 16:44:02
【问题描述】:
我正在尝试使用 ng-model 中的 req.body 访问节点 js 中的值,实际上我的 ng-model 有一个角度 js 过滤器,我需要从节点 js 的输入字段中获取该过滤器值使用req.body,我把我的ng-model代码sn-p贴在这里,请帮我解决
<input type="disable" ng-disabled="true" class="form-control"
name="count" ng-model="table.fields | mysum">
角度滤镜
app.filter('mysum', function() {
return function(items) {
var sum = 0;
items.forEach(function(item) {
if (item.item_count) {
sum += item.item_count;
}
})
return sum;
}
})
【问题讨论】:
-
您不能将
ng-model与过滤器一起使用——ng-model需要绑定到属性。 -
@ExplosionPills 你能告诉我如何访问 ng-model 中的过滤器有什么想法吗
-
我认为您应该
$watch更改模型并更新模型值
标签: javascript angularjs node.js