How to bind ionic3-star-rating dynamic value into data object in ionic

iam get some problems. i have an dynamic form input of rating parameter, i try use ionic3-star-rating module; https://www.npmjs.com/package/ionic3-star-rating. Package its work, but i cant bind dynamic value into my object.

the code like this ;
input-scanner.html

<div *ngFor="let dataP of dataParameter">
    <ion-row class="parameter-input">
        <ion-item text-center class="xgray">
            <h4 class="h-title">{{dataP.name}}</h4>
        </ion-item>
        <ion-item no-padding text-center class="silver">
            <ionic3-star-rating activeIcon="star" defaultIcon="star-outline" activeColor="#e6821e" defaultColor="#404040" readonly="false" [rating]="0"> 
            </ionic3-star-rating> 
        </ion-item>
        <ion-item class="item-input">
            <ion-input type="text"  placeholder="Masukkan notes.." [(ngModel)]="dataP.notes"></ion-input>
        </ion-item>
    </ion-row>
</div>
<button ion-button icon-only (click)="saveRecord(dataParameter)">
    <ion-icon name="checkmark"></ion-icon>
</button>

input-scanner.ts

constructor(
    public navCtrl: NavController, 
    public navParams: NavParams,
    public events: Events,
    public toastCtrl : ToastController,
    public alCtrl : AlertController) {

    events.subscribe('star-rating:changed', (starRating) => 
      {
        this.bindRatingId(1,starRating)  

// how can i get id ; (1) dynamic from my event click the ionic3-star-rating?

    });
  }

  ionViewDidLoad() {
    this.getDataParameter();
  }
  bindRatingId(id,starRating){
    console.log(starRating);
  }
  getDataParameter(){
    var data = [
      {"name":"FIRE BOX. No.157","id":1,"rating":"","notes":""},
      {"name":"PIPA. No.158","id":2,"rating":"","notes":""},
      {"name":"FIRE BOX. No.158","id":3,"rating":"","notes":""},
    ];
    for(let v of data){
        this.dataParameter.push(v);
    }
  }
  saveRecord(data){
    console.log(data);
  }

when i click button saveRecord, the result is ;

[
  {"name":"FIRE BOX. No.157","id":1,"rating":"5","notes":"some input"},
  {"name":"PIPA. No.158","id":2,"rating":"","notes":""},
  {"name":"FIRE BOX. No.158","id":3,"rating":"","notes":"" }
]

the rating value not dynamically set into my object :(,
because i set manual in the bindRatingId() just to set id=1 .

How can i get dynamically value from ionic3-star-rating module ? when i try to add [(ngModel)] in attributee, i have an error code . someone can help me please? thank you before it :slight_smile:

[rating]="dataP.rating", and just assign to the rating property of the backing property.

Hello, I created dynamic cards and each card has a question and a 5 star rating. I have an edit icon in each card also. If I click edit icon then the star rating in a particular card should be able to re-rate. My problem is if I click the edit button, then the star rating in all cards having the re-rate option. Help me to get this.

After I click the edit icon…

Just store the star rating value in data obj … then in html attribute call from ngModel. Important : use an ionic star rating2 plugin not ionic star rating3. Glad to answer it.