src>app>pages>search.html
<ion-content padding>
<ion-list>
<audio-track #audio *ngFor="let track of myTracks" [track]="track" (onFinish)="onTrackFinished($event)">
<ion-item>
<ion-thumbnail item-left>
<img src="{{audio.art}}">
<audio-track-play dark [audioTrack]="audio"><ion-spinner></ion-spinner></audio-track-play>
</ion-thumbnail>
<p><strong>{{audio.title}}</strong> ⚬ <em>{{audio.artist}}</em></p>
<audio-track-progress-bar dark duration progress [audioTrack]="audio" [ngStyle]="{visibility: audio.completed > 0 ? 'visible' : 'hidden'}"></audio-track-progress-bar>
</ion-item>
</audio-track>
</ion-list>
<ion-infinite-scroll (ionInfinite)="doInfinite($event)">
<ion-infinite-scroll-content>
<audio-track #audio *ngFor="let track of myTracks" [track]="track" (onFinish)="onTrackFinished($event)">
<ion-item>
<ion-thumbnail item-left>
<!-- <img src="{{audio.art}}"> -->
<audio-track-play dark [audioTrack]="audio"><ion-spinner></ion-spinner></audio-track-play>
</ion-thumbnail>
<p><strong>{{track.title}}</strong> ⚬ <em>{{track.artist}}</em></p>
<audio-track-progress-bar dark duration progress [audioTrack]="audio" [ngStyle]="{visibility: audio.completed > 0 ? 'visible' : 'hidden'}"></audio-track-progress-bar>
</ion-item>
</audio-track>
</ion-infinite-scroll-content>
</ion-infinite-scroll>
</ion-content>
src>app>pages>search.ts
doInfinite(infiniteScroll) {
this.limit = 3;
let offset = this.page * this.limit;
setTimeout(() => {;
this.searchList(this.keyword, offset).subscribe(
data2 => {
for(let index = 0;index < data2.length;index++){
let itemTrack:any;
itemTrack = [];
itemTrack.art = 'img/johnmayer.jpg';
itemTrack.preload = 'metadata';
itemTrack.src = data2[index].Download + '.mp3';
itemTrack.artist = data2[index].Artist;
itemTrack.title = data2[index].Album;
this.myTracks.push(itemTrack);
}
this.page = this.page + 1;
},
err => {
console.log(err);
},
() => console.log('Movie Search Complete')
);
infiniteScroll.complete();
}, 1000);
}
'Mobile > ionic2' 카테고리의 다른 글
[Ionic2][Visual Studio Code] chrome debugger setting (0) | 2017.03.13 |
---|---|
[Ionic2] REST Http Request (0) | 2017.03.03 |
[ionic2] 앱페이지 추가하기 (0) | 2017.02.28 |