javascript - Component doesn't resolve injection of $scope (angular 1.3.16) -
i have encountered weird error. i'm working on project we're using john papa's angularjs styleguide.
i have following component-file, my-profile.component.js
, attached app.mymodule
my-profile.component.js
(function() { 'use strict'; angular .module('app.mymodule') .component('myprofile', { }) .controller('myprofilecontroller', myprofilecontroller); /*@nginject*/ function myprofilecontroller($scope) { ... } })();
the component rendered using in view file.
app.mymodule
defined in mymodule.module.js
mymodule.module.js
(function () { 'use strict'; angular .module('app.mymodule', []); })();
and app
defined in app.modules.js
, app.mymodule
set app dependency
app.modules.js
(function() { 'use strict'; angular .module('app', [ ... 'app.mymodule' ]); })();
my-profile.component.js
compiles following code
my-profile.component.js (compiled)
(function() { 'use strict'; angular .module('app.mymodule') .component('myprofile', { }) .controller('myprofilecontroller', myprofilecontroller); myprofilecontroller.$inject = ['$scope']; function myprofilecontroller($scope) { ... } })();
but reason, angular fails inject $scope
-service, or other service attempt inject. it produces following error:
error: [$injector:unpr] unknown provider: 1filterprovider <- 1filter http://errors.angularjs.org/1.3.16/$injector/unpr?p0=1filterprovider%20%3c-%201filter @ regex_string_regexp (/layout/js/vendor/angularjs-1.3.16/angular.js?bundlevirtualpath=%7enanbundles%fjs%fvendor:63:12) @ /layout/js/vendor/angularjs-1.3.16/angular.js?bundlevirtualpath=%7e%fbundles%fjs%fvendor:4031:19 @ object.getservice [as get] (/layout/js/vendor/angularjs-1.3.16/angular.js?bundlevirtualpath=%7e%fbundles%fjs%fvendor:4178:39) @ /layout/js/vendor/angularjs-1.3.16/angular.js?bundlevirtualpath=%7e%fbundles%fjs%fvendor:4036:45 @ object.getservice [as get] (/layout/js/vendor/angularjs-1.3.16/angular.js?bundlevirtualpath=%7e%fbundles%fjs%fvendor:4178:39) @ $get [as $filter] (/layout/js/vendor/angularjs-1.3.16/angular.js?bundlevirtualpath=%7e%fbundles%fjs%fvendor:16705:24) @ parser.filter (/layout/js/vendor/angularjs-1.3.16/angular.js?bundlevirtualpath=%7e%fbundles%fjs%fvendor:12234:19) @ parser.filterchain (/layout/js/vendor/angularjs-1.3.16/angular.js?bundlevirtualpath=%7e%fbundles%fjs%fvendor:12228:19) @ parser.primary (/layout/js/vendor/angularjs-1.3.16/angular.js?bundlevirtualpath=%7e%fbundles%fjs%fvendor:12079:22) @ parser.unary (/layout/js/vendor/angularjs-1.3.16/angular.js?bundlevirtualpath=%7e%fbundles%fjs%fvendor:12374:19)
i have component in same folder, attached same module, i can inject service. looks follows:
(function () { 'use strict'; angular .module('app.mymodule') .component('loginview', { }) .controller('loginviewcontroller', loginviewcontroller); /*@nginject*/ function loginviewcontroller($scope, $location) { ... } })();
i can't figure out i'm doing wrong. i've spellchecked, doublechecked, started on over component, attempted $inject $scope on controller manually, no avail.
does have clue what's going on here? :)
edit
as rolandjitsu pointed out, problem in view-file. had used ng-pattern
wrongfully, mislead own inability interpret angular console-errors , 'mildly' misleading error description in angular docs.
yes, seems missing service provider called 1filter
. maybe missing module or files missing?
note: has nothing $scope
, should not fail because of that.
Comments
Post a Comment