Hi I am working on project that has five step form and there is about 10 ng-repeat of json value. I am facing performance problem sometime there is empty ng-repeat so my fields show no value but when I refresh browser it work again I am using ui.router. How do i solve this issue please help. Is there anyway that can ensure all the values are loaded.
Asked
Active
Viewed 64 times
-1
-
Its hard to provide help without the code in question... – haakon.io Sep 27 '16 at 19:26
-
Need a lot more details provided for anyone to offer reasonable answers – charlietfl Sep 27 '16 at 21:02
1 Answers
0
Use the resolve
parameter of angular ui-router to make sure data is available before the controller is instantiated.
https://github.com/angular-ui/ui-router/wiki scroll down to the resolve
section.
Edit: for your particular use case...
$stateProvider.state('wsp.first_step',
{
url: '/first_step',
templateUrl: 'wsp_edit_step_first',
resolve: {
jsonData: function() { //jsonData can be injected into controller
return /* insert json objects here */;
}
}
}).state('wsp.second_step',
{
url: '/second_step',
templateUrl: 'wsp_edit_step_second',
resolve: {
jsonData2: function() { //jsonData2 can be injected into controller
return /* insert json objects here */;
}
}
})
$urlRouterProvider.otherwise('/wsp/first_step')

Oberon
- 200
- 1
- 9
-
how do i do this in $stateProvider .state('wsp.first_step', { url: '/first_step', templateUrl: 'wsp_edit_step_first' }) .state('wsp.second_step', { url: '/second_step', templateUrl: 'wsp_edit_step_second' }) $urlRouterProvider.otherwise('/wsp/first_step'); – sanu Sep 27 '16 at 19:44
-