Why does this Angular controller throw "Error: Unknown provider: nProvider <- n"?
angularjs, javascript
Solution
Turns out the problem was that my scripts were being minified, and the minifier was changing the name of the $scope variable. The Angular.js docs do mention how to minify Angular code.
Problem
jsFiddle of the code: ``` <div ng-app=""> <div ng-controller="FirstCtrl"> <input type="text" ng-model="data.message" /> {{data.message + " world"}} </div> </div> function FirstCtrl($scope) { $scope.data = { message: "Hello" }; } ``` I am just starting to learn Angular using the videos on Egghead.io. Following along I got stuck on the 2nd video where John discusses controllers. It works in his video, fails on my machine. the code is so basic I can't figure out what's throwing this error: ``` > Error: Unknown provider: nProvider <- n > at Error (<anonymous>) > at http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.3/angular.min.js:29:36 > at Object.c [as get] (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.3/angular.min.js:26:310) > at http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.3/angular.min.js:29:121 > at c (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.3/angular.min.js:26:310) > at d (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.3/angular.min.js:26:444) > at Object.instantiate (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.3/angular.min.js:28:80) > at http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.3/angular.min.js:51:512 > at http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.3/angular.min.js:43:67 > at n (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.3/angular.min.js:7:43) ``` This error gets thrown if I use the google CDN as well (from the error, I thought perhaps it was the cdn's fault).