0.0.2 • Published 3 years ago

ng-property v0.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

ng-property

Cause change detection in angualar when the property value is changed without Zone.

It is my first try to use angular without zonejs using a Property() decorator which causes change detection to run when the property value is set.

Installation

npm install ng-property --save

Example

export class AppComponent implements OnInit {
  a: number = 0;
  @Property() b: number = 0;

  // do not cause change detection
  incrementA() {
    this.a++;
  }

  //causes change detection
  incrementB() {
    this.b++;
  }
}

Further

Implement Immutability

Use Reference Check for objects