Skip to content

skol-pro/angular-hal

 
 

Repository files navigation

angular-hal

Build Status

Upgrade to Version 2.0

Methods

old new
halClient.$* $http()
halClient.LinkHeader LinkHeader
resource.$[method] resource.$request().$[method]

Get It!

NPM

npm install angular-hal --save

Bower

bower install angular-hal

Installation

Reference the js files in your html page

<script src="bower_components/rfc6570/rfc6570.js"></script>
<script src="bower_components/angular-hal/angular-hal(.min).js"></script>

You may use it like this:

angular
  .module('app', ['angular-hal'])
  .run(function($rootScope) {
    $rootScope.apiRoot = $http({url: 'https://api.example.com/'});

    $rootScope.$watch('apiRoot', function(apiRoot){
      $rootScope.authenticatedUser = apiRoot.$request().$get('http://example.com/authenticated-user');
    });

  }]);

stay tuned for more!

Configuration

Use the provider $halConfigurationProvider to configure the module.

Options

  • setLinksAttribute - Set links attribute name. (default: _links)
  • setEmbeddedAttribute - Set embedded attribute name. (default: _embedded)
  • setIgnoreAttributePrefixes - Set prefix for meta (hidden) properties. (default: [ '_', '$' ])
  • addIgnoreAttributePrefix - Add a prefix.
  • setSelfLink - Set name of self link. (default: self)
  • setForceJSONResource - Force transformation of JSON response into HAL resource. (default: false, !this may break other modules!)
  • setUrlTransformer - Set a function to change urls. (deprecated)

check this out!

compatibility

If you wish to use this service in old (ie) browsers, you may need to use the following polyfills:

About

HAL client for angularjs

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 97.5%
  • HTML 2.1%
  • CSS 0.4%