mardi 9 juin 2015

How to save select state in url with Ember.js?

I implement content filter with ember.js and I need to save filter state in URL. How can I do this?

I reed this section http://ift.tt/1F5G1AQ and try to do that code http://ift.tt/1KmdT3p But choice saved in URL as

http://ift.tt/1F5G4g2

Why undefined?

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Dynamic select on Ember.js</title>
  <script src="http://ift.tt/1hhKFa1"></script>
  <script src="http://ift.tt/1KmdTjU"></script>
  <script src="http://ift.tt/1F5G1AS"></script>
  <script src="http://ift.tt/1KmdT3r"></script>
</head>
<body>
  <script type="text/x-handlebars" id="index">
    <form>
      {{view "select" content=model
                      optionValuePath="content.number"
                      optionLabelPath="content.title"
                      value=pull
                      prompt="Choice option"}}
    </form>
  </script>
<script id="jsbin-javascript">
App = Ember.Application.create({});

// ROUTES
App.IndexRoute = Ember.Route.extend({
  model: function() {
    return Ember.$.getJSON('http://ift.tt/1b39EeD');
  }
});

// CONTROLLERS
App.IndexController = Ember.Controller.extend({
  queryParams: ['pull'],
  pull: null,
});
</script>



<script id="jsbin-source-javascript" type="text/javascript">App = Ember.Application.create({});

// ROUTES
App.IndexRoute = Ember.Route.extend({
  model: function() {
    return Ember.$.getJSON('http://ift.tt/1b39EeD');
  }
});

// CONTROLLERS
App.IndexController = Ember.Controller.extend({
  queryParams: ['pull'],
  pull: null,
});</script></body>
</html>




Aucun commentaire:

Enregistrer un commentaire