Skip to content
HAL client for angularjs
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist replace jshint with prettier (#69) Aug 6, 2017
src replace jshint with prettier (#69) Aug 6, 2017
test
.codeclimate.yml
.editorconfig
.eslintignore
.eslintrc replace jshint with prettier (#69) Aug 6, 2017
.gitattributes
.gitignore Ignore Yarn Lock Aug 6, 2017
.travis.yml
LICENSE.txt
README.md
bower.json
karma.browserify.conf.js replace jshint with prettier (#69) Aug 6, 2017
karma.jspm.conf.js
karma.webpack.conf.js replace jshint with prettier (#69) Aug 6, 2017
package.json

README.md

angular-hal

Build Status Bower version npm version Dependency Status

npm install angular-hal --save

Check our Documentation

Versions

3.0.0

Version 3.0.0 includes a breaking change: the response interceptor no longer returns a Resource, instead it returns an Angular $http response object. This only affects consuming code when using the $http service directly.

To migrate from 2.x to 3.x, make the following change to your code:

const halConfig = {
    headers: {
        'Accept': 'application/hal+json'
    }
};

// 2.x
$http.get('/api/users', halConfig).then(function (resource) {
  console.log(resource.$hasEmbedded('users')); // true    
});

// 3.x
$http.get('/api/users', halConfig).then(function (response) {
  const resource = response.data;  
  console.log(resource.$hasEmbedded('users')); // true    
});

// 3.x with ES6
$http.get('/api/users', halConfig).then(({ data: resource }) => {
  console.log(resource.$hasEmbedded('users')); // true    
});

Other integrations points are unchanged. For example, using halResourceClient:

let $apiRoot;

$http.get('/api', halConfig)
  .then(function (response) {
    $apiRoot = response.data;   
  });

// later
$apiRoot.$request().$get('users')
  .then(function (resource) {
    console.log(resource.$hasEmbedded('users')); // true    
  });
You can’t perform that action at this time.