Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
  
<script src="//builds.emberjs.com/tags/v1.11.3/ember-template-compiler.js"></script>
<script src="//builds.emberjs.com/tags/v1.11.3/ember.debug.js"></script>
<!--  
<script src="//builds.handlebarsjs.com.s3.amazonaws.com/handlebars-v2.0.0.js"></script>
<script src="//builds.emberjs.com/tags/v1.9.0/ember.js"></script>
-->
  
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  <script type="text/x-handlebars" data-template-name="application">
  <div style="border:1px solid #aaa; background-color:#eee">
  To repeat the bug, click on the link ("go to private link with query params") and after click on login. Nothing happens, appears an error on the transition.retry(). If you wish, you can check it again, clicking on login other time, and the application was logged with a sample data. 
  </div>
  <div>
    {{outlet}}
  </div>
  </script>
  <script type="text/x-handlebars" data-template-name="login">
    <div> 
    {{#link-to "data" 1 (query-params q="pepinillos")}}Go to a private link with query params{{/link-to}}
  </div>
  <button {{action "login"}}>Login</button>
  </script>
  <script type="text/x-handlebars" data-template-name="private">
  <div>{{model.name}}</div>
  {{outlet}}
  <button {{action "logout"}}>Loggout</button>
  </script>
  <script type="text/x-handlebars" data-template-name="data">
  <div>Model: (Query: {{q}})</div>
  {{outlet}}
  </script>
  <script type="text/x-handlebars" data-template-name="data/index">
  <div>Index</div>
  <div>{{model.name}}</div>
  <div>{{substring}}</div>
  </script>
</body>
</html>
 
var logged=false;
var pending_transition=null;
App=Ember.Application.create({});
App.P = Em.Object.extend();
App.P.reopenClass({
  find: function(id) {
    if (id) {
      return App.FIXTURES.findBy('id', id);
    } else {
      return App.FIXTURES;
    }
  }
});
App.FIXTURES=[
  {
    name:"Testing 1",
    id: "1",
  },
  {
    name: "Testing 433",
    id: "2"
  },
  {
    name: "PEPITO",
    id: "0"
  }
];
App.Router.map(function (){
  this.resource('private', {path: '/'}, function (){
    this.resource('data', {path: '/data/:p_id'}, function (){
      this.route('index');
    });
  });
  this.resource('login', {path: '/login'});
});
App.LoginController = Ember.Controller.extend({
  actions: {
    login: function (){
      logged=true;
      if (pending_transition!=null){
        var old_transition=pending_transition;
        pending_transition=null;
        try{
          old_transition.retry();
        } catch (e){
          console.log("catch");
          this.transitionToRoute('data', 0);
        }
      } else {
        this.transitionToRoute('data', 0);
      }
    }
  }
});
App.PrivateRoute = Ember.Route.extend({
  beforeModel: function(transition) {
    if (logged===false) {
      pending_transition=transition;
      this.transitionTo('login');
    }
  }
});
App.PrivateController = Ember.Controller.extend({
  actions:{ logout: function (){
      logged=false;
      this.transitionToRoute('login');
    }
  }
});
App.DataRoute= Ember.Route.extend({
  queryParams: {
    q: { refreshModel:true }
  },
  model: function (params){
    return App.P.find(params.p_id);
  }
});
App.DataController = Ember.Controller.extend({
  queryParams: ["q"],
  q:null,
  actions: {}
});
App.DataIndexController = Ember.Controller.extend({
  substring: function (){
    return "Hello WORLDING";
  }.property(),
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
Drackspro
0viewers