Skip to content

Instantly share code, notes, and snippets.

@AustinMatherne
Created October 2, 2017 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AustinMatherne/04c40cbc612e7b07df93ee26126c814a to your computer and use it in GitHub Desktop.
Save AustinMatherne/04c40cbc612e7b07df93ee26126c814a to your computer and use it in GitHub Desktop.
ngLet Data Binding
import {Observable} from 'rxjs/Observable';
import {of} from 'rxjs/observable/of';
import {LetDirective} from './let.directive';
@Component({
selector: 'my-app',
template: `
<ng-container *ngLet="data$ | async as data"> <!-- single subscription -->
<div>
Data: {{data}} <!-- false -->
</div>
<div>
Data: {{data}} <!-- false -->
</div>
</ng-container>
`,
})
export class App {
data$: Observable<boolean> = of(false);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment