Skip to content

Instantly share code, notes, and snippets.

@ragowthaman
Last active October 16, 2017 10:31
Show Gist options
  • Save ragowthaman/a0efbd70c5ee0f3fc2d5b6f7a8fc8a78 to your computer and use it in GitHub Desktop.
Save ragowthaman/a0efbd70c5ee0f3fc2d5b6f7a8fc8a78 to your computer and use it in GitHub Desktop.
Passing data to incoming component via custom property binding
checked_ids: Array<number> = [40, 50];
<app-incoming-component
*ngIf="show_consultants_summary_component"
[consultantids]="checked_ids"> // binds data to the incoming component's custom property (consultantids in this example)
</app-incoming-component>
// create a new property, type it
@Input() consultantids: Array<number> = [];
// use it in programming; caution: this will not be set in construtor. Code to use this should be in ngOnInit(){}
ngOnInit(){
console.log(consultantids)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment