I don't think angular can be aware that the actual back button was pressed,
but it can respond to route changes:
$scope.$on('$routeChangeSuccess',function(){
console.log('location is now', $location.path())
})
On Thu, Mar 20, 2014 at 1:41 AM, Pushpendra Kumar
<[email protected]>wrote:
> Thanks Luke.
>
> Can I customize browser back button in my controller.
> I will get browser back button event and set some vars in $rootscope.
> Using that var i will hide and show the list page and ite detail page.
>
>
> Pushpendra
>
>
> On 20 March 2014 11:33, Luke Kende <[email protected]> wrote:
>
>> Yes, this is one of the challenges I ran into with routing and angular.
>> Anytime the route changes, the controller and the template are loaded
>> anew. I think we expect angular to behave like cached pages when users hit
>> the back button and it's just there, but it's not the same context with
>> deep linking. A couple of ideas:
>>
>> 1. Don't put the item page in a new route, just ng-hide/ng-show what you
>> want on click and give user a back button so they don't use the browser
>> back button.
>> 2. Store your list items so that they are not reloading from ajax and
>> the back button will still re-render them very quickly.
>>
>>
>> On Wednesday, March 19, 2014 1:36:38 PM UTC-6, Pushpendra Kumar wrote:
>>>
>>> Hello,
>>>
>>>
>>>
>>> I have a list page and on click of any list item i go to
>>> show page.
>>> Now if I press browser back button then list route called
>>> and re-render the list page.
>>> But I don't want this. I want that on pressing browser
>>> back button previous page should be seen without reloading it.
>>> Can we hide it while we are going to show page and when
>>> come back then show this?
>>> Please suggest me the trick.
>>>
>>> List Page ----> show page
>>> list page(but it should
>>> not be reloaded) <----- browser back button
>>>
>>>
>>> Regards,
>>> Pushpendra
>>>
>> --
>> 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.
>>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "AngularJS" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/angular/2OkTqU5GiOw/unsubscribe.
> To unsubscribe from this group and all its topics, 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.
>
--
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.