Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement ngOnChanges life cycle #48

Closed
Hotell opened this issue Feb 16, 2016 · 1 comment
Closed

implement ngOnChanges life cycle #48

Hotell opened this issue Feb 16, 2016 · 1 comment

Comments

@Hotell
Copy link
Member

Hotell commented Feb 16, 2016

So you don't have to use $scope never ever again! :)

it should work like angular 2 https://angular.io/docs/ts/latest/api/core/OnChanges-interface.html

@Component({
  selector: 'my-cmp',
  template: `<p>myProp = {{$ctrl.myProp}}</p>`
})
class MyComponent implements OnChanges {
  @Input() myProp: any;

  ngOnChanges(changes: {[propName: string]: SimpleChange}) {
    console.log('ngOnChanges - myProp = ' + changes['myProp'].currentValue);
  }

}

under the hood it should use probably $scope.watchGroup for perf reasons

@Hotell Hotell added this to the 1.1.0 milestone Feb 16, 2016
@Hotell
Copy link
Member Author

Hotell commented Feb 20, 2016

@Hotell Hotell modified the milestones: 2.0, 1.2 Mar 21, 2016
@Hotell Hotell closed this as completed in 7a19876 Apr 3, 2016
@Hotell Hotell removed this from the 2.0 milestone Apr 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant