Skip to content

Instantly share code, notes, and snippets.

@matanlurey
Created October 5, 2016 14:46
Show Gist options
  • Save matanlurey/4f5c40e4759ac2eb8ec3c8387b04c067 to your computer and use it in GitHub Desktop.
Save matanlurey/4f5c40e4759ac2eb8ec3c8387b04c067 to your computer and use it in GitHub Desktop.
Example of a *ngAwait directive and use.
<!--
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