0

I'm doing an online bookstore project where you can also mark a book as booked. So I would like to assign a function to a button "mark as booked", once this button is pressed that item will have to have the parameter booked and disappear from the page and go to the "reserved books" page. my data I take from a local json and I do not know how to assign the parameter "booked" and make the item disappear if he had this parameter.

example of my page enter image description here

html code:

    <ion-content padding>
      <ion-grid>
        <ion-row>
            <ion-col *ngFor="let libro of libri; let i =index;" >
              <div>
                <ion-card-header><h1>{{libro.title}}</h1></ion-card-header>
                <ion-card-header (ngModelChange)="setYear($event)"><h3 >Autore:{{libro.author}}</h3></ion-card-header>
                <ion-card-header><h4>Anno:{{libro.year}}</h4></ion-card-header>
                <div id="immagine">
                  <img src="../assets/{{libro.imageLink}}">
              </div>
                <button ion-button (click)="modificaItem(libro)" color="">Modify</button>
                <button ion-button (click)="remove(i);" color="danger" >Mark as booked</button>
                <button ion-button color="{{libro.prenotato ? 'danger' : 'secondary'}}">Status</button>
              </div>

            </ion-col>
        </ion-row>
    </ion-grid> 

    </ion-content>

(click)="remove(i);" is a provvisory function

niccoicco9
  • 53
  • 1
  • 2
  • 9
  • 1. `libri[i].booked = true;` 2. https://stackoverflow.com/questions/34164413/how-to-apply-filters-to-ngfor –  Jun 20 '18 at 07:35
  • Booking should make a service call and persist it in server, or the session will be destroyed on a page refresh. – sabithpocker Jun 20 '18 at 07:43
  • i have this error ERROR Error: Uncaught (in promise): Error: Template parse errors: Can't have multiple template bindings on one element. Use only one attribute named 'template' or prefixed with * – niccoicco9 Jun 20 '18 at 07:52

0 Answers0