I have a page of data that can be viewed as a list or as markers on a map. It also has filtering in the sidebar. I currently have this structured as separate map and list pages but I want to merge them so that the filters remain when switching views.
I have tried using ui-router
but due to my markup I cannot keep the filtering within a parent state, as per my question here: How do I show multiple views in an abstract state template?
My current markup is like this:
<div class="main-container" ng-controller="PlanningCtrl" data-county-parish-id="1478">
<main class="page-content">
<!-- toggles between map and list views -->
<a href="/map">View map</a>
<!-- main content view here -->
<appl-list></appl-list>
<!-- <appl-map></appl-map> -->
</main>
<aside class="sidebar">
<div refine-results info="refine" id="SearchForm" class="refine-search"></div>
</aside>
</div>
The data array is within the controller as $scope.filteredApplications
and on each page this is filtering and displaying fine within each directive.
I guess my question is: how can I toggle between the two <appl-*>
directives and display the same filtered records?