Closed martiansnoop closed 8 years ago
+1
However you can avoid the array syntax using an explicit annotation:
.component('my-app', {
// @ngInject
templateUrl: ($locale) => `views/${$locale.id}/app/app.html`,
controller: Controller
})
Correct, the new angular 1.5 way of defining components breaks ngAnnotate / uglify.
Unknown provider: aProvider <- a
is the error that is given in my case.
:+1:
+1
+1
+1
This is also an issue with controllers, i.e. this doesn't work (Unknown provider: aProvider <- a
):
angular.module('myApp').component('sox', {
controller: SoxController,
...
});
function SoxController($rootScope) {
...
While this does:
angular.module('myApp').component('sox', {
controller: SoxController,
...
});
SoxController.$inject = ['$rootScope'];
function SoxController($rootScope) {
...
This feature would be useful in my application as well. Explicit annotation works fine, but it would be nice if this were automatic. @olov Does your closing this issue mean that this feature won't ever be added?
@canac changes won't be made to ng-annotate going forward: https://github.com/olov/ng-annotate/issues/245
ng-annotate version: 1.2.1
It appears that with the new component, the template and templateUrl properties can also be a function called by the injector (forgive the toy example):
It doesn't look like ng-annotate is currently annotating these, though, so I had to fall back to the array syntax: