I have a question, i hope someone could help me out
I try to read a m3u file with xhr. That all works perfect, but when i try to set the reponse to an array to show it in my list (ngFor) - my list is empty
@IonicPage()
@Component({
selector: 'page-radiotv',
templateUrl: 'radiotv.html',
})
export class RadiotvPage {
public tvlist: any[];
constructor(public navCtrl: NavController, public navParams: NavParams) {}
ionViewDidLoad() {
console.log('ionViewDidLoad RadiotvPage');
var xhr = new XMLHttpRequest();
xhr.open("GET", "assets/m3u/TV.m3u");
xhr.overrideMimeType("audio/x-mpegurl"); // Needed, see below.
xhr.onload = parse;
xhr.send();
// Parse it
function parse () {
this.tvlist = M3U.parse(this.response);
console.log(this.tvlist);
};
}
}
<ion-list>
<ion-item *ngFor="let tvsender of tvlist | async">
{{tvsender.title}}
</ion-item>
</ion-list>