Reputation: 2605
I'm using uglify to minify my angular files. Where do I use the $inject
method in my app.js file?
(function(){
var myApp = angular.module('myApp',['ngRoute']);
myApp.config(function ($routeProvider){
$routeProvider
.when('/',
{
controller: 'HotelsController',
templateUrl: 'js/views/hotels.html'
})
.when('/hotel/:hotelId',
{
controller: 'HotelController',
templateUrl: 'js/views/hotel.html'
})
.otherwise({ redirectTo: '/' });
})
})();
Upvotes: 0
Views: 87
Reputation: 384
I think you mean how to remain injectables in minification using $inject? If yes, then:
(function(){
var myApp = angular.module('myApp',['ngRoute']);
myApp.config(configFunction);
function configFunction ($routeProvider) {
$routeProvider
.when('/',
{
controller: 'HotelsController',
templateUrl: 'js/views/hotels.html'
})
.when('/hotel/:hotelId',
{
controller: 'HotelController',
templateUrl: 'js/views/hotel.html'
})
.otherwise({ redirectTo: '/' });
}
configFunction.$inject = ['$routeProvider'];
})();
Upvotes: 1