2

on this example, SkillsSelectComponent receives input skills from a parent component.

@Component({
  selector: 'skills-select',
  template: `{{ skills | json }}`
})
export class SkillsSelectComponent {

  @Input() skills;

  ngOnInit() {
    console.log('skills', this.skills);
  }
}

If skills change once the component has been created, {{skills }} inside template will be updated but how to detect change inside the component ?

1 Answer 1

4

I used ngOnChanges

ngOnChanges(changes: any): void {
    console.log('change', changes.skills.currentValue);
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.