moving ngIf

master
Matt Huntington 9 years ago
parent 53eea259d2
commit 0a5905bb4b

@ -388,3 +388,12 @@ and:
```html
<li *ngFor="let character of apiObservable | async">
```
You might notice that "Search Results" is always displayed even when there are no results. Let's change that:
```html
<section>
<h2 *ngIf="(apiObservable | async) !== null">Search Results</h2>
```
Now the `h2` subscribes to the observable and tests to see if there are values in it

@ -2,8 +2,8 @@
<h2>Search For A Star Wars Character</h2>
<input [(ngModel)]="name" type="text" placeholder="Character Name" (keyup)="findCharacter(name)" />
</section>
<section *ngIf="apiObservable">
<h2>Search Results</h2>
<section>
<h2 *ngIf="(apiObservable | async) !== null">Search Results</h2>
<ul>
<li *ngFor="let character of apiObservable | async">
<h3>{{character.name}}</h3>

Loading…
Cancel
Save