角度嵌套对象-TypeError:无法读取属性'应用程序'的未定义
Angular nested objects - TypeError: Cannot read property 'app' of undefined
我有如下嵌套对象:
$scope.userForm.app.status = 'Scheduled';
$scope.userForm.app.recurring = 'One-off';
但我得到以下错误:
TypeError: Cannot read property 'app' of undefined
有没有一种方法可以定义它,这样就不会发生错误?
我试过做$scope.userForm.app = {}
之类的事情,但不确定这是否是正确的解决方案?
我还有以下内容:
input.form-control#status(ng-model='userForm.status', name='status', type='text', disabled='')
和控制器
$scope.userForm = {};
$scope.userForm.status = 'Scheduled';
然而,这并没有正确地与模型绑定,也没有以
错误为userForm
未定义。仔细阅读错误消息。无法读取未定义的属性app
。因此,您需要将userForm
设置为一个对象:
$scope.userForm = {
app: {
status: 'Scheduled',
recurring: 'One-off'
}
};
相关文章:
- 表单's的action属性-如何在javascript中指定完整的应用程序路径
- 使用 SharePoint 查询字符串值作为应用程序部件属性
- jquery.mobile-1.4.5.js:26未捕获类型错误:无法设置属性'移动'react应用程序
- 找不到属性'link_to'on对象(生成的应用程序控制器)
- Webpacked Angular2应用程序类型错误:无法读取属性'getOptional'的未定义
- 角度嵌套对象-TypeError:无法读取属性'应用程序'的未定义
- 使用 Jquery 将属性 Required 添加到 Razor 应用程序中的输入中
- 在 mvc 应用程序中使用 href 属性重定向 asp.net 不起作用
- redux/react 应用程序中的状态有一个带有化简器名称的属性
- 在 Angular 应用程序上收到错误:类型错误:无法读取未定义的属性“then”
- 类型错误:无法读取 nodejs 应用程序中未定义的属性“方法”
- jQuery Mobile Windows应用商店应用程序:JavaScript运行时错误:无法获取属性'ind
- Ti.App.fireEvent不起作用;error未捕获类型错误:无法读取属性'应用程序'的未定义
- 查询嵌入闪亮应用程序中的数据表的状态/属性
- 通过activexobject实现excel应用程序的方法和属性
- 谷歌应用程序脚本中的属性服务出现意外行为
- TypeError:无法读取属性'日期'在Meteor应用程序中使用tsega:bootstrap3日期
- 如何访问angular js应用程序中的javaservlet会话属性
- 在Angularjs应用程序中,使用嵌套对象属性过滤ng repeat不起作用
- Angularjs应用程序中使用AND运算过滤ng个基于重复的多个属性