Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Ember 1.7 Brings Query Params to Community

Ember 1.7 Brings Query Params to Community

Lire ce contenu en français

Alex Navasardyan has announced the release of Ember.js 1.7 to the JavaScript community.

Navasardyan is an Ember.js release team member and described the release as bringing "bug fixes, potentially breaking changes and new features."

Among the new features in version 1.7 is support for query parameters. Giving thanks to Alex Matchneer and his core Ember.js team in the article "Ember 1.7.0 and 1.8 Beta Released", Navasardyan explains the feature, saying: 

With this API, each query param is bound to a property on a controller, such that changes made to query params in the URL (e.g. user presses the back button) will update the controller property, and vice versa.

The API handles many of what Navasardyan describes as the "tricky aspects" of maintaining a binding to a URL.

These include correctly casting new URL query parameter values to the datatype expected by the controller property, omitting default query parameter values from the URL to avoid unnecessarily cluttering the URL with default values, and coalescing multiple controller property changes into one single URL update.

Other new features announced include nestable routes, removing the restriction that only this.resource can have nested child routes. With this change, Navasardyan says,

this.route can be nested like this.resource, but unlike this.resource, the namespace of child routes is appended rather than reset to a top-level namespace.

In the Ember.js discussion forum, user Jinshui Tang commented on advance notice of the query params release, saying it had "resolved one of the most important issues with the pagination of part of my application."

Praise for query parameters also came from Ember users on Twitter. EmberSherpa responded to Alex Matchneer's release announcement saying "thank you so much for QP. It’s the most exciting thing to hit Ember stable since 1.0." 

According to the Ember.js 1.7.0 changelog the new release brought with it also a small number of breaking changes and deprecations, including On Controllers:

the content property is now derived from model. This reduces many caveats with model/content, and also sets a simple ground rule: Never set a controllers content, rather always set its model and Ember will do the right thing.

And for empty arrays:

An empty array is treated as falsy value in bind-attr to be in consistent with if helper. Breaking for apps that relies on the previous behaviour which treats an empty array as truthy value in bind-attr.

Among the listed bug fixes brought by the 1.7 Ember release were:

  • Controllers with query params are unit testable.
  • Controllers have new QP values before setupController.
  • makeBoundHelper supports unquoted bound property options.
  • SimpleHandlebarsView should not re-render if normalized value is unchanged. Allow Router DSL to nest routes via this.route.

with many more listed in the Ember.js 1.7.0 changelog here.

Already announced in the 1.8 Ember beta, the internal implementation of the view layer has been refactored, and for Internet Explorer 6 and 7 usage of Ember is deprecated, with support being removed in the next major release.

Ember.js is released via an MIT licence. InfoQ readers can contribute to Ember.js via its GitHub project

Rate this Article