This project is generated with yo angular generator version 0.16.0.
1. npm install -g grunt-cli bower yo generator-karma generator-angular
2. Install yarn1. grunt serve1. grunt build
2. pm2 start ecosystem.config.js1. yarn add / yarn add -D
2. Search and add the path of the required min files from the node_modules folder into index.htmlFor step-by-step instructions on using Yeoman and this generator to build a TODO AngularJS application from scratch see this tutorial.
Install yo, grunt-cli, generator-angular and generator-karma:
npm install -g grunt-cli yo generator-karma generator-angular
Generates a controller and view, and configures a route in app/scripts/app.js connecting them.
Example:
yo angular:route myrouteProduces app/scripts/controllers/myroute.js:
angular.module('myMod').controller('MyrouteCtrl', function ($scope) {
// ...
});Produces app/views/myroute.html:
<p>This is the myroute view</p>Explicitly provide route URI
Example:
yo angular:route myRoute --uri=my/routeProduces controller and view as above and adds a route to app/scripts/app.js
with URI my/route
Generates a controller in app/scripts/controllers.
Example:
yo angular:controller userProduces app/scripts/controllers/user.js:
angular.module('myMod').controller('UserCtrl', function ($scope) {
// ...
});Generates a directive in app/scripts/directives.
Example:
yo angular:directive myDirectiveProduces app/scripts/directives/myDirective.js:
angular.module('myMod').directive('myDirective', function () {
return {
template: '<div></div>',
restrict: 'E',
link: function postLink(scope, element, attrs) {
element.text('this is the myDirective directive');
}
};
});Generates a filter in app/scripts/filters.
Example:
yo angular:filter myFilterProduces app/scripts/filters/myFilter.js:
angular.module('myMod').filter('myFilter', function () {
return function (input) {
return 'myFilter filter:' + input;
};
});Generates an HTML view file in app/views.
Example:
yo angular:view userProduces app/views/user.html:
<p>This is the user view</p>Generates an AngularJS service.
Example:
yo angular:service myServiceProduces app/scripts/services/myService.js:
angular.module('myMod').service('myService', function () {
// ...
});You can also do yo angular:factory, yo angular:provider, yo angular:value, and yo angular:constant for other types of services.
Generates an AngularJS service decorator.
Example:
yo angular:decorator serviceNameProduces app/scripts/decorators/serviceNameDecorator.js:
angular.module('myMod').config(function ($provide) {
$provide.decorator('serviceName', function ($delegate) {
// ...
return $delegate;
});
});