I'm attempting to utilize ng-annotate on my Angular application, but it seems to be not working at all.
Here is the configuration part:
(function () {
'use strict';
angular.module('app')
.config(/*@ngInject*/ routes);
function routes ($stateProvider, $urlRouterProvider) {
$stateProvider
.state('home', {
url: '/',
templateUrl: 'app/main/view.html',
controller: 'MainCtrl'
});
$stateProvider
.state('signup', {
url: '/signup',
templateUrl: 'app/signup/view.html',
controller: 'SignUpCtrl'
});
$urlRouterProvider.otherwise('/');
}
})();
After running the Angular app, I encountered the following error message:
Error: [$injector:modulerr] Failed to instantiate module app due to:
[$injector:strictdi] routes is not using explicit annotation and cannot be invoked in strict mode
http://errors.angularjs.org/1.3.15/$injector/strictdi?p0=routes
Additionally, ng-annotate is integrated into my gulp config file:
gulp.task('html', ['inject', 'partials'], function () {
var partialsInjectFile = gulp.src(options.tmp + '/partials/templateCacheHtml.js', { read: false });
var partialsInjectOptions = {
starttag: '<!-- inject:partials -->',
ignorePath: options.tmp + '/partials',
addRootSlash: false
};
var htmlFilter = $.filter('*.html');
var jsFilter = $.filter('**/*.js');
var cssFilter = $.filter('**/*.css');
var assets;
return gulp.src(options.tmp + '/serve/*.html')
.pipe($.inject(partialsInjectFile, partialsInjectOptions))
.pipe(assets = $.useref.assets())
.pipe($.rev())
.pipe(jsFilter)
.pipe($.ngAnnotate())
.pipe($.uglify({ preserveComments: $.uglifySaveLicense })).on('error', options.errorHandler('Uglify'))
.pipe(jsFilter.restore())
.pipe(cssFilter)
.pipe($.csso())
.pipe(cssFilter.restore())
.pipe(assets.restore())
.pipe($.useref())
.pipe($.revReplace())
.pipe(htmlFilter)
.pipe($.minifyHtml({
empty: true,
spare: true,
quotes: true,
conditionals: true
}))
.pipe(htmlFilter.restore())
.pipe(gulp.dest(options.dist + '/'))
.pipe($.size({ title: options.dist + '/', showFiles: true }));
});
Can anyone point out what I might be doing incorrectly?