Я столкнулся с действительно странной ошибкой. Я работаю над проектом, в котором мы используем John Papa's AngularJS styleguide.
У меня есть следующий компонент-файл, my-profile.component.js
, прикрепленный к app.mymodule
моему-profile.component.js
(function() {
'use strict';
angular
.module('app.mymodule')
.component('myProfile', { })
.controller('MyProfileController', myProfileController);
/*@ngInject*/
function myProfileController($scope) {
...
}
})();
компонент визуализируется с использованием в моем файле представления.
app.mymodule
определяется в mymodule.module.js
mymodule.module.js
(function() {
'use strict';
angular
.module('app.mymodule', []);
})();
app
И определяется в app.modules.js
, где app.mymodule
устанавливается как приложение зависимости
app.modules .js
(function() {
'use strict';
angular
.module('app', [
...
'app.mymodule'
]);
})();
my-profile.component.js
компилирует следующий код
моего-profile.component.js (составитель)
(function() {
'use strict';
angular
.module('app.mymodule')
.component('myProfile', { })
.controller('MyProfileController', myProfileController);
myProfileController.$inject = ['$scope'];
function myProfileController($scope) {
...
}
})();
Но по какой-то причине, угловой не может впрыскивать $scope
-SERVICE, или любую другую услугу, которую я пытаюсь ввести. It produces the following error:
Error: [$injector:unpr] Unknown provider: 1FilterProvider <- 1Filter
http://errors.angularjs.org/1.3.16/$injector/unpr?p0=1FilterProvider%20%3C-%201Filter
at REGEX_STRING_REGEXP (/layout/js/vendor/angularjs-1.3.16/angular.js?bundleVirtualPath=%7eNaNbundles%fjs%fvendor:63:12)
at /layout/js/vendor/angularjs-1.3.16/angular.js?bundleVirtualPath=%7e%fbundles%fjs%fvendor:4031:19
at Object.getService [as get] (/layout/js/vendor/angularjs-1.3.16/angular.js?bundleVirtualPath=%7e%fbundles%fjs%fvendor:4178:39)
at /layout/js/vendor/angularjs-1.3.16/angular.js?bundleVirtualPath=%7e%fbundles%fjs%fvendor:4036:45
at Object.getService [as get] (/layout/js/vendor/angularjs-1.3.16/angular.js?bundleVirtualPath=%7e%fbundles%fjs%fvendor:4178:39)
at $get [as $filter] (/layout/js/vendor/angularjs-1.3.16/angular.js?bundleVirtualPath=%7e%fbundles%fjs%fvendor:16705:24)
at Parser.filter (/layout/js/vendor/angularjs-1.3.16/angular.js?bundleVirtualPath=%7e%fbundles%fjs%fvendor:12234:19)
at Parser.filterChain (/layout/js/vendor/angularjs-1.3.16/angular.js?bundleVirtualPath=%7e%fbundles%fjs%fvendor:12228:19)
at Parser.primary (/layout/js/vendor/angularjs-1.3.16/angular.js?bundleVirtualPath=%7e%fbundles%fjs%fvendor:12079:22)
at Parser.unary (/layout/js/vendor/angularjs-1.3.16/angular.js?bundleVirtualPath=%7e%fbundles%fjs%fvendor:12374:19)
У меня есть еще один компонент в той же папке, прикрепленную к тому же модулю, где можно легко придать любую услугу. Он выглядит следующим образом:
(function() {
'use strict';
angular
.module('app.mymodule')
.component('loginView', { })
.controller('LoginViewController', loginViewController);
/*@ngInject*/
function loginViewController($scope, $location) {
...
}
})();
Я действительно не могу понять, что я делаю неправильно. Я проверял орфографию, дважды проверял, начал над компонентом, попытался ввести $ scope на контроллер вручную, но безрезультатно.
Кто-нибудь знает, что здесь происходит? :)
EDIT
Как rolandjitsu отметил, что это проблема, на мой взгляд-файл. Я использовал ng-pattern
неправомерно, но был введен в заблуждение своей собственной неспособностью интерпретировать угловые ошибки консоли и «мягко» вводящее в заблуждение описание ошибки в угловых документах.