AngularJS - 在$范围对象缺失NG-模型项目 [英] AngularJS - missing ng-model items in $scope object

查看:110
本文介绍了AngularJS - 在$范围对象缺失NG-模型项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图创造一个可以编辑每一行和保存更改的表。我无法张贴的所有行中的物品后,pressing保存。由于某些原因,只有一些元件被发送。任何帮助或洞察力将AP preciated。

I'm trying to create a table in which you can edit each row and save your changes. I'm having trouble posting all of the items in the row after pressing save. For some reason, only some of the elements are being sent. Any help or insight would be appreciated.

下面是我的 code

我看着在开发工具的控制台,它看起来像$ scope.editedEvent对象(app.js 12号线)包含未定义PARAMATERS,除了名。

I watched the console in dev tools, and it looks like the $scope.editedEvent object (line 12 in app.js) contains undefined paramaters, except for "name".

推荐答案

正如我在我的评论说,你不能把NG-模型和NG绑定(或{{}})在相同的元素。 NG-模型是输入类型字段(输入,选择,文本区域...)和NG绑定的跨度,DIV等。

As I said in my comment, you can't put ng-model and ng-bind ( or {{}} ) in the same element. Ng-model is for input type fields (input, select, textarea...) and ng-bind for span,div,etc.

因此​​,基于我从你的问题理解了我已经更新了code,使之角兼容,当您单击保存按钮,将与该内容更新$范围的变量editedEvent行并从选择的选择的值。

So based on what I've understood from your question I've updated the code to make it "angular compliant", when you click the save button it will update the $scope variable editedEvent with the contents of that row and the selected value from the select.

plunkr

这篇关于AngularJS - 在$范围对象缺失NG-模型项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆