Mặc dù tôi đã quen với vấn đề uglify khi sử dụng Angular , nhưng tôi lại bắt đầu gặp phải vấn đề này ngay bây giờ với một chỉ thị cụ thể, ngay cả khi tôi đang sử dụng kiểu giống mảng để khai báo phụ thuộc:
angular.module('app.directives').directive('domainImg', ['Endpoint', function (Endpoint) {
return {
restrict: 'A',
controller: function ($scope, $element, $attrs) {
$attrs.$set('ngSrc', Endpoint + $attrs.ngSrc);
}
};
}]);
Tệp chính của tôi khai báo các mô-đun một cách riêng biệt.
angular.module('app.providers', []).constant('Endpoint', 'http://www.multzfidelidade.com.br/sistema/');
angular.module('app.tools', []);
angular.module('app.services', []);
angular.module('app.resources', []);
angular.module('app.controllers', []);
angular.module('app.directives', []);
angular.module('App', ['ui.mask', 'templates', 'app.providers', 'app.tools', 'app.services', 'app.resources', 'app.controllers', 'app.directives'])
Bây giờ, khi tôi sử dụng chỉ thị này, tôi nhận được eProvider chưa biết <- e vấn đề
Lỗi: [$ injectionor: unr ] http://errors.angularjs.org/1.4.8/ $ injectionor / unr? P0 = rProvider% 20% 3C-% 20r
Tôi đang sử dụng như thế này:
<img class="prize-directive-image" ng-src="{{prize.image}}" domain-img/>
Nếu tôi xóa thẻ miền-img , sự cố sẽ biến mất. Ngoài ra, nếu tôi không xác minh mã, vấn đề cũng sẽ biến mất.
gulp.task('default', function () {
// Concat all JS files into a single one called app.min.js
gulp.src(['public_html/js/*.js', 'public_html/js/**/*.js', 'public_html/*.js', 'public_html/modules/**/*.js', '!public_html/app.min.js'])
.pipe(concat('app.min.js'))
// .pipe(uglify()) // Without this line the problem doesn't happen
.pipe(gulp.dest('dist/'));
// Concat all HTML directives into a single one
gulp.src('public_html/js/**/**/*.html')
.pipe(htmlmin({collapseWhitespace: true}))
.pipe(templateCache('templates.min.js', {standalone: true}))
.pipe(gulp.dest('dist/'));
})
Tôi đã hy vọng tôi có thể hiểu được một số điểm mà tôi có thể đã sai trong chỉ thị cụ thể này.
Cảm ơn bạn trước.