feat: optimize the code for the management page 98/96398/1
authorcyuamber <xuranyjy@chinamobile.com>
Mon, 30 Sep 2019 05:09:11 +0000 (13:09 +0800)
committercyuamber <xuranyjy@chinamobile.com>
Mon, 30 Sep 2019 05:09:25 +0000 (13:09 +0800)
Change-Id: I5475b377783ebef4a264b89f437eeebcb9bd60f8
Issue-ID: USECASEUI-307
Signed-off-by: cyuamber <xuranyjy@chinamobile.com>
usecaseui-portal/src/app/views/management/management.component.ts

index 8220a16..b1a88e1 100644 (file)
@@ -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 = '';
     }
 }