javascript - Injecting First Angular Factory -


i'm way overdue injecting first angular factory . . .

my code:

.factory('debts', function($q, $scope){      return ma;  })  .controller('admin', function ($scope, debts) {       $scope.debts = debts;       $scope.debts.ma(); }) 

with $scope in factory following error: unknown provider: $scopeprovider <- $scope <- debts

i read somewhere should not include $scope in factory when take out 2 errors:

1) provider 'debts' must return value $get factory method 2) uncaught referenceerror: $scope not defined

the code factory several hundred lines , yes references $scope , $q. please let me know need change make work.

the $scope available controllers , link function of directives. why factory cannot find it. maybe meant $rootscope?

.factory('debts', function($q, $rootscope){      return ma;  }) 

???


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 -