I am having a heck of a time trying to figure out why I\'m getting the Unknown provider error in Angular. I\'ve checked every other question I could find on the subject and
So the problem was that I was setting up the EmployeeCtrl controller through ng-controller inside my partial's view, like so:
<div class="viewPage" ng-controller="EmployeeCtrl">
When using resolve, however, the controller set up must be done through the router in order for it to be available at runtime. I removed the ng-controller="EmployeeCtrl
...
<div class="viewPage">
... and presto, like nothing ever happened.
I have to note that I received help from the kind, patient folks over on the AngularJS IRC channel...
Since you defined the factory called Employee
, you should use the exact name to refer to this module when you inject it to the controller.
var employeeCtrl = app.controller('EmployeeCtrl', [
'$scope',
'employees',
Change to
var employeeCtrl = app.controller('EmployeeCtrl', [
'$scope',
'Employee',