Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Hypermedia for Backbone.js
Latest commit 096c4b9 @mikekelly Merge pull request #14 from openfirmware/feature/backbone-update-1.1.2
Pass Model options when creating HAL.Model


Replacement Model and Collection components which interop with the media type application/hal+json.

application/hal+json is a media type for linking based on JSON, you can read more about it here:

Example Usage

MyModel = HAL.Model.extend({
  /* usual custom methods and properties go here */

var instance = new MyModel({
  _links: {
    self: {
      href: '/example',
    eg: {
      href: '/boo'
  _embedded: {
    foo: {
      _links: {
        self: {
          href: '/embedded'
      foo_prop: 'foo_val'
  prop: 'val',
  other_prop: 'other_val'

instance.url()          // #=> '/example'
instance.get('prop')    // #=> 'val'
instance.get('_links')  // #=> undefined
instance.links          // #=> { self: { href: '/example', }, eg: { href: '/boo' } }

Source Code

The library is written in CoffeeScript. The source files are contained in the lib directory. If you make changes to these, you can rebuild the javascript using the command cake compile.

Something went wrong with that request. Please try again.