In my app, there are a few Angular UI-router states where I use ng-show to display different views in the same state. For instance, the signup state is two steps. So after they’ve created their account information, they’re next asked for address information.
Using a scope variable called state, I manipulate properties of the state to switch different views on and off. As an extra step, I even added $scope.$digest() after the $scope.state update. But I’m still noticing that the DOM update is noticeably slower on native iOS than in Ionic View or iOS Simulator.
I’ve read that ng-if performs slightly better but it also destroys the data after ui-router state transition, which I do not want.
My question is would using ng-class perform any better than ng-show? As I understand it, the two are not so different in terms of their procedure. They both listen on scope variables for a valid condition and add/remove a class accordingly.
If there is no worthwhile distinction between these two approaches, would anyone be able to recommend a different solution?
i would not use ng-show/ng-if/ng-class for such things.
i would create one abstract base state for that “wizard” with a base controller to hold all the data
this state has an own ui-view --> the child states hangs in.
So you can simply redirect from one state to another.
Then if you are using view-caching the back-navigation and back to the forward view will be faster.
Additional to that you could add something like step-indicator on top of the base-state to have something like a sub-navigation