From 03faffe8da4c35f2807334489ba80eb562890d68 Mon Sep 17 00:00:00 2001 From: cyuamber Date: Mon, 30 Sep 2019 13:09:11 +0800 Subject: feat: optimize the code for the management page Change-Id: I5475b377783ebef4a264b89f437eeebcb9bd60f8 Issue-ID: USECASEUI-307 Signed-off-by: cyuamber --- .../src/app/views/management/management.component.ts | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'usecaseui-portal/src/app') diff --git a/usecaseui-portal/src/app/views/management/management.component.ts b/usecaseui-portal/src/app/views/management/management.component.ts index 8220a166..b1a88e1e 100644 --- a/usecaseui-portal/src/app/views/management/management.component.ts +++ b/usecaseui-portal/src/app/views/management/management.component.ts @@ -28,27 +28,21 @@ import { ManagemencsService } from '../../core/services/managemencs.service'; export class ManagementComponent implements OnInit { @HostBinding('@routerAnimate') routerAnimateState; //Routing animation + nocuster: boolean; + firstCustomer: string; + constructor(private managemencs: ManagemencsService) { } ngOnInit() { this.getAllCustomers(); } - - nocuster = true; - firstCustomer = null; - AllCustomersdata = []; - + // Get all customers getAllCustomers() { this.managemencs.getAllCustomers().subscribe((data) => { - if (data.length > 0) { - this.nocuster = false; - } else { - this.nocuster = true; - } + this.nocuster = data.length > 0 ? false : true; }) } - createNewCustomer(customer) { let createParams = { customerId: customer @@ -63,6 +57,6 @@ export class ManagementComponent implements OnInit { }) } clearCustomerInput() { - this.firstCustomer = null; + this.firstCustomer = ''; } } -- cgit 1.2.3-korg