Created
October 5, 2016 14:46
-
-
Save matanlurey/4f5c40e4759ac2eb8ec3c8387b04c067 to your computer and use it in GitHub Desktop.
Example of a *ngAwait directive and use.
This file contains 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
<!-- | |
Assume we have the following Dart code: | |
Future<String> onName => _nameService.getName(); | |
--> | |
<!-- Default case: On future complete, load data as $value --> | |
<template [ngAwaitThen]="onName"> | |
Hello {{$value}}! | |
</template> | |
<!-- Advanced case: On error, timeout, etc --> | |
<template [ngAwait]="onError"> | |
<template [ngAwaitThen]>Hello {{$value}}!</template> | |
<template [ngAwaitTimeout]>Timed out waiting...</template> | |
<template [ngAwaitError]>Error occured: {{$error}}}!</template> | |
</template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment