0
我想在我的角度應用程序上使用ng-annotate,但根本不起作用。使用ng-annotate失敗
我有配置部分:
(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('/');
}
})();
,當我運行的角度應用程序,然後我得到的錯誤信息:
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
和NG-註釋在我一飲而盡配置實現文件:
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 }));
});
我在做什麼錯了?