Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49230

Pushing multiple data in an array doesn't work in ionic

$
0
0

@louis5017 wrote:

Hello, i’m actually trying to push some epub in an array to make them appear in a list in my home page, but when i try to push multiple epub like that this doesn’t while just with one book it work. does anyone have a solution?

export class HomePage {
  
  books: {}[];
  constructor() {
    let book1 = new Book();
    book1.label = "Moby Dick (unpacked)";
    book1.file =  "../../assets/books/agatha-christie-dix-petits-negres.epub";
    this.books.push(book1);

    this.books = [];
    let book2 = new Book();
    book2.label = "Moby Dick (.epub)";
    book2.file =  "../../assets/books/moby-dick.epub";
    this.books.push(book2);
  }
  ionViewDidLoad() {
    console.log('ionViewDidLoad HomePage');
  }
  show(book) {
    console.log('show', book);
    // this.navCtrl.push(BookPage, {
    //   book: book  
    // });
  }
}

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 49230

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>