Skip to content

Instantly share code, notes, and snippets.

@ArtemRomanovsky
Created February 20, 2020 12:10
Show Gist options
  • Select an option

  • Save ArtemRomanovsky/d965103a6babe8e9c1f33535e4273272 to your computer and use it in GitHub Desktop.

Select an option

Save ArtemRomanovsky/d965103a6babe8e9c1f33535e4273272 to your computer and use it in GitHub Desktop.
@Component({
selector: 'parent',
template: `
<span>{{ name }}</span>
<child [text]="text"></child>
`
})
export class ParentComponent {
...
}
export class ChildComponent implements OnInit {
@Input() text;
constructor(private parent: ParentComponent) {}
ngOnInit() {
this.parent.name = 'updated name';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment