I have an angularjs app with two states :-
function routeConfig($stateProvider, $urlRouterProvider) {
$urlRouterProvider.when('/main','/main/list');
$stateProvider
.state('main', {
url: '/main',
//abstract: true,
templateUrl: 'app/pages/main/main.html',
title: 'Main',
sidebarMeta: {
icon: 'ion-android-home',
order: 0,
},
}).state('main.list', {
url: '/list',
templateUrl: 'app/pages/main/list/List.html',
title: 'Main',
controller: 'ListCtrl',
resolve: {
Data: function(myService) {
return myService.getData();
}
}
}).state('main.detail', {
url: '/detail/:symbol',
templateUrl: 'app/pages/main/detail/Detail.html',
title: 'Graph',
controller: "DetailCtrl",
});
}
Scenario - Basically by default state one (list) opens and fetches data, then we can navigate to state two (detail) by clicking on a button from state one.
Problem - When I go back from state two to state one, data is fetched again, which takes time to load the screen.
This makes the website slow.
Help me as to how to prevent this..