財產「的companyName」我試圖解決這個錯誤,但我堅持和需要幫助解決這個,因爲我是新來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 (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)
$scope.companyModify = function(company) {
var param = {
companyName: $scope.companyName,
billColumn: $scope.billColumn,
billTitle: $scope.billTitle,
serviceTax = $scope.serviceTax,
wishMessage = $scope.wishMessage,
billTypeId = $scope.billTypeId
};
SocketService.post(apiManage.apiList['CompanyModify'].api, param).then(function(resp) {
var data = resp.data.response;
if (data.status === true) {
angular.forEach($scope.companyList, function(value) {
if (value.billTypeId == billTypeId) {
value.$edit = false;
}
});
Notify.alert(data.message, {
status: 'success',
pos: 'top-right',
timeout: 5000
});
$scope.load();
} else {
Notify.alert(data.message, {
status: 'danger',
pos: 'top-right',
timeout: 5000
});
}
});
};
use scope.ComponyName它看起來你注入範圍代替$範圍。 – Jenny
$ scope.companyName的值是從哪裏來的? –
companyName來自公司表。 –