Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- orders = [
- {id_service: "1", id_empresa: "9", nome_service: "Servico 01", qtd: "0", checkup: "false", price_service : "250"},
- {id_service: "2", id_empresa: "9", nome_service: "Servico 02", qtd: "0", checkup: "false" price_service : "300"},
- {id_service: "3", id_empresa: "9", nome_service: "Servico 03", qtd: "0", checkup: "false" price_service : "400"}
- ]
- calc(i) {
- let obj = JSON.parse(this.orders[i].price_service);
- if (this.orders[i].qtd == 0) {
- this.result.push(obj);
- this.orders[i].qtd = 1;
- }
- else {
- this.result.splice(i, 1);
- this.orders[i].qtd = 0;
- }
- this.result.reduce(function (a, b) {
- return a + b['obj'];
- }, 0);
- }
- <div *ngFor="let item of orders; let i = index; ">
- <ion-item>
- <ion-label class="title">{{item.nome_service}}
- <span>{{item.price_service}}</span>
- </ion-label>
- <ion-checkbox (click)="calc(i)" checked="{{item.checkup}}" color="green"></ion-checkbox>
- </ion-item>
- <p>{{result}}</p>
- </div>
Add Comment
Please, Sign In to add comment