Update npm and install the necessary packages
$ sudo npm install -g npm
$ sudo npm install -g yo grunt-cli gulp-cli bower generator-angular-fullstack
Create a folder for your project and cd into it
$ mkdir my-new-project && cd $_
$ yo angular-fullstack [app-name]
Build the solution with Grunt or Gulp
$ grunt build
Run server and client tests (grunt/gulp)
$ grunt test
Run server, client, or end-to-end tests (grunt/gulp)
$ grunt test:server
$ grunt test:client
$ grunt test:e2e
Run the application in dev mode (grunt/gulp)
$ grunt serve
Run the application in production mode (grunt/gulp)
$ grunt serve:dist
Create the route. This will create the route, controller, template, CSS, and test file.
$ yo angular-fullstack:route products
Create a products factory or service (the model). A service returns a constructor function (the "this" keyword is available) so we need the "new" operator. A factory gets the value returned by invoking the function. It allows creating a closure where the returned object exposes "public" methods.
$ yo angular-fullstack:factory products
Steps to do in the code:
- Edit the product factory/service to return the products data.
- By convention the name of services/factories are capitalized so update it from products to Product.
- Inject the product factory into the product controller and make it available to the view through $scope.
- Edit the HTML template to use the products exposed through $scope.
$ yo angular-fullstack:endpoint product