javascript - AngularJS: '$scope is not defined' -


i keep getting '$scope not defined' console errors controller code in angularjs:

angular.module('articles').controller('articlescontroller', ['$scope', '$routeparams', '$location', 'authentication', 'articles',         function($scope, $routeparams, $location, authentication, articles){             $scope.authentication = authentication;         }     ]);   $scope.create = function() { // throws error on instance of $scope     var article = new articles({         title: this.title,         content: this.content     });      article.$save(function(response) {         $location.path('articles/' + response._id);     }, function(errorresponse) {         $scope.error = errorresponse.data.message;     }); }; 

where in angularjs mvc files should looking @ find problems $scope not being defined properly?

place code inside controller:-

angular.module('articles').controller('articlescontroller', ['$scope', '$routeparams', '$location', 'authentication', 'articles',         function($scope, $routeparams, $location, authentication, articles){             $scope.authentication = authentication;  $scope.create = function() { // throws error on instance of $scope     var article = new articles({         title: this.title,         content: this.content     });      article.$save(function(response) {         $location.path('articles/' + response._id);     }, function(errorresponse) {         $scope.error = errorresponse.data.message;     }); };         }     ]); 

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -