Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9172681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:24:28+00:00 2026-06-17T16:24:28+00:00

I observe a undesired behaviour when it comes to the browser back button and

  • 0

I observe a undesired behaviour when it comes to the browser back button and emberjs. If the user clicks on the back button, the page shows twice the rendered handlebar template.

In case that the history is long enough, that “works” even several times and the page gets longer and longer. Somebody seen that issue already (and even solved it)?

My application is currently quite what is shown by Trek at http://trek.github.com/ except that I moved to the new router API of pre4.

Versions

  • emberjs 1.0 pre4
  • handlebars 1.0 rc1
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:24:30+00:00Added an answer on June 17, 2026 at 4:24 pm

    Follow-up to my own question. There are two issues in my code. One of them I tracked down and share here the solution in case somebody have similar issues.

    I had a model definition like

    App.Member.reopenClass({
      allMembers: [],
      findAll: function(){
        $.ajax({
          url: 'https://api.company.com/members',
          dataType: 'json',
          context: this,
          success: function(response){
            response.data.forEach(function(member){
              this.allMembers.addObject(App.Member.create(member))
            }, this)
          }
        })
        return this.allMembers;
      }
    });
    

    The allMembers: [] was a reference that retained all members. Upon going back/forth, members for reloaded from the backend and stored again on allMembers.

    To resolve this one, just define allMembers in findAll:

    App.Member.reopenClass({
      findAll: function(){
        var allMembers = [];
        $.ajax({
          url: 'https://api.company.com/members',
          dataType: 'json',
          context: allMembers,
          success: function(response){
            response.data.forEach(function(member){
              this.addObject(App.Member.create(member))
            }, this)
          }
        })
        return allMembers;
      }
    });
    

    There is a second issue that is most probably also related to the way I combined the routes. I will post on it as soon as I have the solution.

    Update, 2013-01-22

    Ok, the second issue has been found as well and emberJS + back button now works perfectly. Again, I would like to quickly summarize what the problem was in case that somebody stumbles over it as well.

    The routing definition looked as follows:

    App.Router.map(function() { 
      this.resource("areas", { path: "/areas" });   
      this.resource("area",  { path: "/areas/:refId" }, function() {
        this.route("new",    { path: "/areas/new" });   
    });
    

    Furthermore, ‘new’ and ‘area’ used the very same view and controller. So, the issue was between the parent route ‘area’ and its subroute ‘new’. The attempt to combine all together, and do some magic within the controller to distinguish which case it is, is just not recommended…

    So, solution was:

    • use mixins to avoid code duplications (both, ‘new’ and ‘area’ use some Google Geocoder stuff)
    • create a nice and simple routing as shown below.

    And the code would be

    App.Router.map(function() { 
      this.route("areas",   { path: "/areas" });
      this.route("area",    { path: "/areas/:refId" });
      this.route("newarea", { path: "/area/new"});
    });
    

    That’s it. Enjoy or comment. Always glad to get input from experts

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I observe the following strange behaviour in Vim 7.3: When I'm below a fold,
Please observe this fiddle: http://jsfiddle.net/8nrPm/3/ I have set the width of the Animation button
Observe the following program written in Java (complete runnable version follows, but the important
Observe the following Python script, Script.py: import subprocess src_directory = 'Z:\z_7z\Some_Directory' zip_file_name = 'Test.7z'
I observe that my tan(float) function from the cmath library is returning a negative
When observe the definition of ICollection extends IEnumerable. It provides size and synchronization members
document.observe('click', function(e, el) { if (e.target != Element.descendantOf('calendar')) { $('calendar').fade(); } }); I am
Is it possible to observe (subscribe to) changes to values stored under different keys
It's simple to observe the documents scroll event but I can't seem to find
I am surprised to observe that mono is faster than .NET. Does anyone know

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.