Docs

Generators

๐Ÿ“˜

Separate multiple words with a dash (e.g.: add-items)

๐Ÿ‘

Do not append the word Service, Component or Directive. They will be automatically generated for you.

๐Ÿ“˜

Auto-import

All generators will automatically update your imports and module in the correct file. For components, the index.components.js will be automatically updated. You can disable this behavior by adding the --no-import flag or from your config/generators.php.

Below is a list of the available generators:

artisan ng:page {settings}

Creates a new page in /angular/app/pages by generating the following:

  • angular/app/pages/settings.page.html
  • angular/app/pages/settings.less

artisan ng:component {user-profile}

Creates a new component in /angular/components/ by generating the following:

  • angular/directives/components/user-profile.component.html
  • angular/directives/components/user-profile.component.js
  • angular/directives/components/user-profile.less

and an ngDescribe test file

  • tests/angular/app/components/user-profile.spec.js

๐Ÿ“˜

Components vs Directives

Make sure to read the official angular docs on the difference between Components & Directives.

In most scenarios, you would use components as the building block for your User Interface.

artisan ng:directive {is-admin}

Creates a new directive in /angular/directives/ by generating the following:

  • angular/directives/is-admin/is-admin.directive.js

and an ngDescribe test file

  • tests/angular/directives/is-admin.spec.js

artisan ng:dialog {login}

Creates a new dialog in /angular/dialogs/ by generating the following:

  • angular/dialogs/login/login.html
  • angular/dialogs/login/login.dialog.js
  • angular/dialogs/login/login.less

artisan ng:service {cache}

Creates a new service in /angular/services/ by generating the following:

  • angular/services/cache.service.js

and an ngDescribe test file

  • tests/angular/services/cache.spec.js

artisan ng:filter {ucfirst}

Creates a new service in /angular/filters/ by generating the following:

  • angular/filters/ucfirst.filter.js

artisan ng:config {http}

Creates a new service in /angular/config/ by generating the following:

  • angular/config/http.config.js