我是 Angular 的新手,我不明白为什么我们将它分配给控制器内的变量。
angular.module('NoteWrangler')
.controller('NoteCreateController', function($http){
var controller = this;
this.saveNote = function(note){
controller.errors = null;
$http({method: 'POST', url: '/notes', data: note})
.catch(function(note){
controller.errors = note.data.error;
})
};
});