ember.js - Ember V1.0.0-pre.2: how to get query string parameters -
is @ possible query string parameters in pre2?
e.g., transition route so: #/customer/cn-001
cn-001
match parameter along lines of /customer/:customernumber
.
i think want:
routers:
app = ember.application.create({ applicationcontroller: ember.objectcontroller.extend(), customercontroller: ember.objectcontroller.extend(), router: ember.router.extend({ root: ember.route.extend({ index: em.route.extend({ route: '/', connectoutlets: function(router) { router.route('/customer/cn-001'); } }), customer: em.route.extend({ route: '/customer/:customernumber', connectoutlets: function(router, customer) { router.get("applicationcontroller").connectoutlet('customer', customer); }, serialize: function(router, context){ return { id: context.number }; }, deserialize: function(router, params) { return ember.object.create({ number: params.customernumber }); } }) }) }) }); app.customerview = ember.view.extend({ templatename: 'customer' })
templates:
<script type="text/x-handlebars" data-template-name="application"> {{outlet}} </script> <script type="text/x-handlebars" data-template-name="customer"> <h2>customer</h2> {{number}} </script>
here jsfiddle showing working. hope help.
Comments
Post a Comment