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

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -