【发布时间】:2015-04-20 20:52:15
【问题描述】:
我的一些平均堆栈代码有问题。下面显示了代码以及我收到的错误。有没有人有任何建议。这似乎是一个简单的声明错误,但我似乎找不到解决方案
customersApp.controller('CustomersUpdateController', ['$scope', 'Customers', '$log',
function($scope, Customers, $log) {
// Update existing Customer
this.update = function(updatedCustomer) {
var customer = updatedCustomer;
customer.$update(function() {
$log.info('Made it inside ok');
//Dont want to take user anywhere else
// $location.path('customers/' + customer._id);
}, function(errorResponse) {
$scope.error = errorResponse.data.message;
});
};
}
]);
这是错误:
TypeError: Cannot read property '$update' of undefined
at update (http://localhost:3000/modules/customers/controllers/customers.client.controller.js:115:12)
at http://localhost:3000/lib/angular/angular.js:10880:21
at http://localhost:3000/lib/angular/angular.js:10655:29
at http://localhost:3000/lib/angular-touch/angular-touch.js:441:9
at Scope.$eval (http://localhost:3000/lib/angular/angular.js:12788:28)
at Scope.$apply (http://localhost:3000/lib/angular/angular.js:12886:23)
at Scope.$delegate.__proto__.$apply (<anonymous>:855:30)
at HTMLButtonElement.<anonymous> (http://localhost:3000/lib/angular-touch/angular-touch.js:440:13)
at http://localhost:3000/lib/angular/angular.js:2853:10
at forEach (http://localhost:3000/lib/angular/angular.js:325:18)
在加载页面时,我还收到错误 {Uncaught TypeError: Cannot read property 'getToggleElement' of null}。
【问题讨论】:
标签: angularjs node.js mean-stack