Answer the question
In order to leave comments, you need to log in
How to minify js files that are loaded via lazy load?
Through gulp, I connect and minify everything with bower_components and the main angular file - app.js into one file. Controllers, services and directives will be connected via lazy load depending on the route.
Example (from app.js):
/* Setup Rounting For All Pages */
TestApp.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) {
// Redirect any unmatched url
$urlRouterProvider.otherwise("/dashboard");
$stateProvider
// Dashboard
.state('dashboard', {
url: "/dashboard",
templateUrl: "/app/src/views/dashboard/dashboard.html",
data: {
pageTitle: 'Admin Dashboard',
breadcrumbs: 'Dashboard',
},
controller: "DashboardController",
resolve: {
deps: ['$ocLazyLoad', function($ocLazyLoad) {
return $ocLazyLoad.load({
name: 'TestApp',
files: [
'/app/src/controllers/dashboard/DashboardController.js',
]
});
}]
}
})
}]);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question