import Route from '@ember/routing/route'; import { inject as service } from '@ember/service'; import BaseRoute from 'hino-hearts/routes/base'; export default BaseRoute.extend({ accountManagement : service(), accountCustomerUioData:service(), store : service(), init() { this._super(...arguments); }, model() { let newData = {}; var management = this.get('accountManagement.model'); // alert(management.accountCustomerUio.length); if(management != null && management != undefined && management.accountCustomerUio != null && management.accountCustomerUio != undefined ){ var jumlah = management.accountCustomerUio.length; if(jumlah == 0){ let data1 = this.accountCustomerUioData.createRecord(); this.accountManagement.addRow(data1, "accountCustomerUio"); let data2 = this.accountCustomerUioData.createRecord(); this.accountManagement.addRow(data2, "accountCustomerUio"); let data3 = this.accountCustomerUioData.createRecord(); this.accountManagement.addRow(data3, "accountCustomerUio"); }else if(jumlah == 1){ let data1 = this.accountCustomerUioData.createRecord(); this.accountManagement.addRow(data1, "accountCustomerUio"); let data2 = this.accountCustomerUioData.createRecord(); this.accountManagement.addRow(data2, "accountCustomerUio"); }else if(jumlah == 2){ let data1 = this.accountCustomerUioData.createRecord(); this.accountManagement.addRow(data1, "accountCustomerUio"); } } return this.accountManagement.model; }, //templateName : 'account-management/input' });