File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 11< a (click) ="getEntries() "> Get All Entries</ a > | < a (click) ="getEntries({include: 1}) "> Query Entries</ a > | < a (click) ="getEntry('651CQ8rLoIYCeY6G0QG22q', {include: 1}) "> Get entry</ a >
2+ < div *ngIf ="l "> Loading...</ div >
23< pre >
34 {{r | json}}
45</ pre >
Original file line number Diff line number Diff line change @@ -8,14 +8,23 @@ import { ContentfulService } from './modules/contentful/contentful.service';
88} )
99export class AppComponent {
1010 r : any ;
11+ l = false ;
1112
1213 constructor ( private cs : ContentfulService ) { }
1314
1415 getEntries ( query ?: any ) {
15- this . cs . getEntries ( query ) . then ( res => this . r = res ) ;
16+ this . l = true ;
17+ this . cs . getEntries ( query ) . then ( res => {
18+ this . r = res ;
19+ this . l = false ;
20+ } ) ;
1621 }
1722
1823 getEntry ( id : string , query ?: any ) {
19- this . cs . getEntry ( id , query ) . then ( res => this . r = res ) ;
24+ this . l = true ;
25+ this . cs . getEntry ( id , query ) . then ( res => {
26+ this . r = res ;
27+ this . l = false ;
28+ } ) ;
2029 }
2130}
You can’t perform that action at this time.
0 commit comments