@ngx-ext/decorators
Version:
Set of decorators making your life easier.
31 lines (25 loc) • 1.25 kB
Markdown
# Angular Extensions: Decorators
### `npm i -ext/decorators`
### List of decorators
1. ``
It may be useful to distinguish reusable components from pages used in the routing and with a huge probability loading necessary data. In such cases, `` decorator comes in handy. It accepts the same options as `` except "selector":
```typescript
import { Page } from '@ngx-ext/decorators';
export class HomePage {}
```
2. ``
Since Angular v9 every class using properties decorators (like ``) has to be decorated. Angular update script fills that hole by adding `` decorator, but it has its drawbacks:
* looks misleading if applied on some parent class
* can cause tslint error:
> TSLint: The name of the class DeploymentGridComponent should end with the suffix Directive (https://angular.io/styleguide#style-02-03) (directive-class-suffix)
Then `` decorator comes to the rescue:
```typescript
import { AbstractClass } from '@ngx-ext/decorators';
export abstract class ParentComponent<Parameter extends ParemeterModel> implements OnInit, OnChanges {
iCanBeSafelyInherited: string;
}
```