ember.js - Nested object in queryParams -
ember.js - Nested object in queryParams -
question: how can pass object of type
query: { id: bla, email: bla-bla-bla } in queryparams?
simple way this
app.articlescontroller = ember.arraycontroller.extend({ queryparams: ['query'], query: { id: bla, email: bla-bla-bla } }); does not work, of course of study :)
p.s. sorry bad english language :)
ember query parameters doesn't back upwards setting object queryparam. supports key-value pairs. according documentation:
query parameters optional key-value pairs appear right of ? in url. example, next url has 2 query params, sort , page, respective values asc , 2:
if you're looking bind both id , email properties querystring vals, you'll have specify explicitly:
app.articlescontroller = ember.arraycontroller.extend({ queryparams: ['id, email'], id: null, email: null }); if want bind id , email straight query object, setup observer or computed property (depending on goal) observes alter in of id or email properties , updates other object have locally.
if want streamline setup, consider using controller mixin defines mutual set of properties in queryparams plus corresponding array. you'd able like:
app.articlescontroller = ember.arraycontroller.extend( myqueryparamsmixin, { queryparams: myqueryparams // other properties set explicitly mixin // technically, don't need declare properties since they'll bound anyway // queryparams, it's practice allow readers of mixin know properties // in use. }); ember.js
Comments
Post a Comment