Skip to content

Instantly share code, notes, and snippets.

@joanllenas
Created February 12, 2018 00:14
Show Gist options
  • Save joanllenas/f28400544cfec339aeae861281bf811b to your computer and use it in GitHub Desktop.
Save joanllenas/f28400544cfec339aeae861281bf811b to your computer and use it in GitHub Desktop.
RemoteData approach template - Slaying a UI Antipattern with Angular
<div class="pure-u-1-1 welcome" *ngIf="service.state | isNotAsked">
<p>Welcome, use the controls above to obtain today's sunset and sunrise times.</p>
</div>
<div class="pure-u-1-1" *ngIf="service.state | isLoading">
<p class="loading">
Loading...
</p>
</div>
<div class="pure-u-1-1" *ngIf="service.state | isSuccess">
<p>
Sunrise: {{ service.extractSuccess().results.sunrise }}<br>
Sunset: {{ service.extractSuccess().results.sunset }}
</p>
</div>
<div class="pure-u-1-1" *ngIf="service.state | isFaliure">
<p class="error">
Error: {{ service.extractFaliure() }}
</p>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment