Javascript 未捕获类型错误:无法读取属性';公司名称';未定义的
我试图解决此错误,但由于我是angularjs的新手,因此我陷入困境,需要帮助解决此问题:Javascript 未捕获类型错误:无法读取属性';公司名称';未定义的,javascript,angularjs,Javascript,Angularjs,我试图解决此错误,但由于我是angularjs的新手,因此我陷入困境,需要帮助解决此问题: TypeError: Cannot read property 'companyName' of undefined at Scope.$scope.companyModify (app.js:8501) at $parseFunctionCall (base.js:21610) at callback (base.js:30772) at Scope.$eval
TypeError: Cannot read property 'companyName' of undefined
at Scope.$scope.companyModify (app.js:8501)
at $parseFunctionCall (base.js:21610)
at callback (base.js:30772)
at Scope.$eval (base.js:23672)
at Scope.$apply (base.js:23771)
at HTMLButtonElement.<anonymous> (base.js:30777)
at HTMLButtonElement.dispatch (base.js:4430)
at HTMLButtonElement.elemData.handle (base.js:4116)
我认为您的对象“param”构造错误 你能试试吗
var param = {
companyName: $scope.companyName,
billColumn: $scope.billColumn,
billTitle: $scope.billTitle,
serviceTax: $scope.serviceTax,
wishMessage: $scope.wishMessage,
billTypeId: $scope.billTypeId
};
有“=”符号,应替换为“:”
其次,请确保所有变量,companyName,billColumn。。etc附加到模型,即调用方法之前的$scope-$scope.companyModify()
让我知道这是否有帮助。使用scope.companyName它看起来是注入了scope而不是$scope.companyName。值$scope.companyName来自何处?companyName来自Company表。
var param = {
companyName: $scope.companyName,
billColumn: $scope.billColumn,
billTitle: $scope.billTitle,
serviceTax: $scope.serviceTax,
wishMessage: $scope.wishMessage,
billTypeId: $scope.billTypeId
};