Decorators for Angular, which will make life easier for you
npm install --save custom-angular-decorators
And add the include
line "node_modules/custom-angular-decorators/**/index.ts"
in tsconfig.json
file
Decorators | Status |
---|---|
AutoUnsubscribe | Testing |
LifeCycleLog | Testing |
NotNull | Testing |
DisableField | Not started |
Phone | Not started |
Decorator for auto unsubscribed your Subscription property and array with Subscription elements.
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
})
@AutoUnsubscribe(environment.production)
export class AppComponent { }
Logger for your component property on LifeCycle Hooks.
export class AppComponent implements OnInit {
@LifeCycleLog(environment.production)
public property;
ngOnInit() {
this.property = 10;
}
}
Check null property in model and generate exception.
class Model {
@NotNull
public field;
constructor(field) {
this.field = field;
}
}