PERF: implemented OnInit on search page to speed up load

This commit is contained in:
jason.wall 2017-01-24 17:47:26 -05:00
parent 755aa28c3b
commit 632ee22189

View File

@ -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()
{