Last active
October 16, 2017 10:31
-
-
Save ragowthaman/a0efbd70c5ee0f3fc2d5b6f7a8fc8a78 to your computer and use it in GitHub Desktop.
Passing data to incoming component via custom property binding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
checked_ids: Array<number> = [40, 50]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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