From 632ee221890ed3e44a9d0496d2fab44fc8a2c7ef Mon Sep 17 00:00:00 2001 From: "jason.wall" Date: Tue, 24 Jan 2017 17:47:26 -0500 Subject: [PATCH] PERF: implemented OnInit on search page to speed up load --- DynamicBibleIonic/src/pages/search/search.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/DynamicBibleIonic/src/pages/search/search.ts b/DynamicBibleIonic/src/pages/search/search.ts index 5b63a00c..acd2a039 100644 --- a/DynamicBibleIonic/src/pages/search/search.ts +++ b/DynamicBibleIonic/src/pages/search/search.ts @@ -1,4 +1,4 @@ -import { Type, Component } from '@angular/core'; +import { Type, Component, OnInit } from '@angular/core'; import { Loading, LoadingController, ModalController, NavParams, AlertController, MenuController } from 'ionic-angular'; import { Storage } from '@ionic/storage'; @@ -11,7 +11,7 @@ import { Reference } from '../../libs/Reference'; @Component({ templateUrl: 'search.html' }) -export class SearchPage +export class SearchPage implements OnInit { searchQuery = ''; userProfile: UserProfile; @@ -30,7 +30,10 @@ export class SearchPage ) { this.userProfile = new UserProfile(UserProfile.createDefaultUser()); + } + ngOnInit(): void + { // Check if there is a profile saved in local storage this.local.get('profile').then(profile => { @@ -39,14 +42,14 @@ export class SearchPage if (profile !== null) t = JSON.parse(profile); - this.userProfile.update(t, local); + this.userProfile.update(t, this.local); this.initializeItems(this.userProfile); }).catch(error => { console.log(error); - }); - } + }); + } actionsMenu() {