Skip to content

Instantly share code, notes, and snippets.

@armanozak
Last active May 9, 2019 08:30
Show Gist options
  • Save armanozak/b00449e497748036b393e332289de15e to your computer and use it in GitHub Desktop.
Save armanozak/b00449e497748036b393e332289de15e to your computer and use it in GitHub Desktop.
Angular Context - One-way Data-binding (#4) #blog
@Component({
selector: 'my-app',
template: `
<context-provider
provide="progress progressStriped progressType"
[contextMap]="{progressType: 'type'}"
>
<one-way></one-way>
</context-provider>
`,
})
export class AppComponent implements OnInit {
progress = 0;
progressStriped = true;
progressType = 'info';
ngOnInit() {
interval(1000).pipe(take(10)).subscribe(
n => this.progress = (n + 1) * 10
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment