Write a service to save global data. When entering the list page, first determine whether the global data object has data. If there is no data, the original data will be displayed directly. If there is data, it means that the search has been completed, and the search data or other display methods you like will be displayed.
You can use angularjs broadcast, the key code is as follows
ListController
SearchController
$rootScope top controller handling
That’s it. The core is the use of broadcast
Write a service to save global data. When entering the list page, first determine whether the global data object has data. If there is no data, the original data will be displayed directly. If there is data, it means that the search has been completed, and the search data or other display methods you like will be displayed.
After clicking search, of course you need to re-request the data. Just re-assign the value to your $scope.data= and it will be ok