A BundleOrderer implementation for ordering Angular application files
The orderer expects files to be named using the dot notation
- app.controller.js
- logger.service.js
- skip.filter.js
- clock.directive.js
Additionally, each folder should contain a module.js
file, which can optionally contain
the module name too: app.module.js
.
Any files that don't match one of the known types: service, controller, directive, filter or module, will not be sorted and will remain at the original position.
Note that the orderer does not diffrentiate between services and factories, these should both be marked
as .service
.
The orderer currently assumes that module files should appear last, as the module file will include all it's components:
angular.module('app', [])
.service('logger', [LoggerService])
.controller('AppController', [AppController])
.filter('skip', skipFilter)
.directive('clock', clockDirective);
In the BundleConfig.cs
file, you can use the helper extension method, .AddAngularApp
.
bundles.AddAngularApp("~/bundles/app", "~/Scripts/App");
The first parameter is the virtual name of the bundle, the second parameter is the Directory containing the application angular files.