Thank you for the solution Aleck! I use a directive to load the filters and 
show the filter values on the page, so I would prefer to have this stored 
in a service or rootscope. Going by the other suggestions, I am leaning 
towards a service.

On Monday, March 17, 2014 11:32:09 AM UTC+5:30, Aleck Landgraf wrote:
>
> For keeping track of search information, I've had luck pulling out search 
> or filter parameters of the $route, and putting them in with $location
>
>            .when('/quoteOne', {
>             controller: 'quoteOneCtrl',
>             templateUrl: 'quoteOne.html',
>             resolve: {
>                 'search_payload': ['search_services', '$route', 
> function(search_services, $route){
>                     var params = $route.current.params;
>                     var q = params.q || "";
>                     // params: (query, number_per_page, page_number, 
> order_by, sort_reverse, params) 
>                     return search_services.search_buildings(q, 10, 1, "", 
> false, params);
>                 }],
>
>
> and to add them:
> $location.path('/quoteOne').search('q=' + $scope.search_input);
>  
> -Aleck
>
> On Monday, March 17, 2014 1:17:09 AM UTC-4, Rajesh wrote:
>>
>> We have a fairly complex application (more than 100 views and 
>> controllers). Let me explain the problem space with an example. When a user 
>> is trying to create a new quotation (View 1), they may not find a product 
>> in the list. So they need to go to a different view (View 2) to add a new 
>> product, and then continue working on the quotation (View 1). The data 
>> entered on the quotation before adding the new product should be retained 
>> while returning after adding the new product.
>>
>> While using a service to share data between these controllers seems to do 
>> the job, we have a large number of such use cases, and therefore there will 
>> be a large number of services and dependencies to manage. Is it a good 
>> practice to use the rootScope for storing and retrieving the state instead?
>>
>> A similar use case is to retain the filter (search) values on a list view 
>> after the user navigates to a different view and comes back.
>>
>> Thanks!
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to