0.0.5 • Published 6 years ago

ngx-schematics-collection v0.0.5

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

Schematics Collection

npm version

Master: Build Status

Develop: Build Status

Some useful schematics.

Install

npm install --save-dev ngx-schematics-collection

Usage

Generate form control

ng generate ngx-schematics-collection:form-control component-name

The command above will generate a component with NG_VALUE_ACCESSOR related code.

The other parameters are same as generate component.

Generate validator directive

Using command below to generate a validator directive:

ng g ngx-schematics-collection:validator my-validator

or generate a async validator

ng g ngx-schematics-collection:validator my-validator --isAsync

The other parameters are same as generate directive.

Generate route guards

You can create different types of route guard:

  • CanActivate to mediate navigation to a route.
  • CanActivateChild to mediate navigation to a child route.
  • CanDeactivate to mediate navigation away from the current route.
  • Resolve to perform route data retrieval before route activation.
  • CanLoad to mediate navigation to a feature module loaded asynchronously.

Just choose a type of route guard, then use it to --type parameter, for example: create a 'CanActivate' route guard:

ng g ngx-schematics-collection:route-guard route-guard-name --type=CanActivate

The other parameters are same as generate service.