angular-registry

A Registry Module for AngularJS

Added by: Sam Deering

GitHub

Repository

johannestroeger/angular-registry

Stats

Stars: 10

Watchers: 10

Forks: 1

Module Description

angular-registry Build Status Build Status

A Registry Module for AngularJS. Handling Values and Constants within Angular-Projects easily and controller-wide.


Features

  • set and get deep objects / arrays and even functions by string notation
  • configure defaults and reset to them

Demos

Installation

Angular-Registry as a Bower Package

$ bower install angular-registry

Or if you already using Bower, add this entry into bower.json:

"dependencies": {
  "angular-registry": "0.x.x"
}

API

  • defaults(object)
  • cacheLimit(number)
  • get([expression])
  • set(expression, value)
  • del(expression)
  • reset([expression])

Usage

Define dependencies

var app = angular.module('app', ['johannestroeger.registry']);

Set Defaults (optional)

app.config(function ($registryProvider){
  $registryProvider.defaults({
    "default": "values"
  });
});

Setting Cache Limit (optional) default: 100

Since angular-registry is caching function $parse calls, you are able to define the limit/capacity of this cache. it uses the LRU strategy.

app.config(function ($registryProvider){
  $registryProvider.cacheLimit(1000);
});

Set / Get / Del (and Reset, if you have set defaults)

app.controller('MyCtrl', ['$registry', function ($registry) {
  $registry.set('key', 'value'); // setting registry entry: 'key' => 'value'
  $registry.get('key')           // getting register entry: 'key'
  $registry.get()                // complete register 
  $registry.reset()              // reset to configured defaults
}]);

Contributers

Thanks to the following developers:

Module stats last updated: 2015-04-28 11:08:30

Disclaimer: Some data on this page may have been gathered from the authors GitHub respository. If you see any mistakes or outdated information please let us know. Thanks!