Hello,
As my 1st step into Ionic world I wrote some application that contains 3 views based on $stateProvider
. The goal was to check performance. For this purpose I took contact list + calendar (pretty big json content).
$stateProvider
.state('groups', {
url: '/groups',
views: {
'groups-tab': {
templateUrl: 'partials/groups.html',
controller: 'GroupsCtrl'
}
}
})
.state('group-detail', {
url: '/group/:eventId',
views: {
'groups-tab': {
templateUrl: 'partials/group-detail.html',
controller: 'GroupDetailCtrl'
}
}
})
.state('contacts', {
url: '/contacts',
views: {
'groups-tab': {
templateUrl: 'partials/contacts.html',
controller: 'ContactsCtrl'
}
}
});
$urlRouterProvider.otherwise('/groups');
I use Nexus4 - 5
Even if I have static Json files stored in service, it takes me about 2 seconds to switch (aka redirect) between views. Because by this way we recreate all scopes (controllers).
I asked question about infinity list to up-down, I hope it will enter to next versions (i use 0.9.26 so far).
My next step was to leave for a while $stateProvider
and create stand-alone controller (a.e one view) to verify two options:
- ng-if
- ng-show/ng-hide
The ngIf
directive removes/recreates a portion of the DOM tree. ON false
relevant elements are removed from the DOM, on true
, a copy (lets say clone) of the element is re-inserted into the DOM.
So this way is similar to $stateProvider
because we still rerun our controllers.
Therefore I implemented ng-show
but got the ~same results. Its not surprise me because we only hide DOM elements but our controller continues to watch on any change/update and causes to additional delay.
I want to ask Ionic experts what you suggest to use in my case when each view has big list of items
(BTW, all stuff I load from service/factory after preloaded from native platform)
Thanks,