Skip to content
/ ng-di Public
forked from jmendiara/ng-di

Spectacular Angular Dependency Injection for Javascript isolated as a library

License

Notifications You must be signed in to change notification settings

abgil/ng-di

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ng-di

Spectacular Angular Dependency Injection isolated as a library

CURRENTLY IN DEVELOPMENT v0.0.2

Getting Started

On the server

Install the module with: npm install ng-di

var di = require('ng-di').di;
di.module(...);

In the browser

Download the production version or the development version.

In your web page:

<script src="dist/ng-di.min.js"></script>
<script>
di.module(...)
</script>

In your code, you can attach ng-di's methods to any object.

<script>
this.exports = Bocoup.utils;
</script>
<script src="dist/ng-di.min.js"></script>
<script>
Bocoup.utils.di.module(...);
</script>

Documentation

This library simply isolates AngularJS dependency injection, exposing its module API as part of it.

All the DOM management has been removed, and makes this library the ideal artifact for using Javascript Dependency Injection in javascript only apps, libraries...

It's available as di instead of angular

All the angular utility functions (noop, forEach...) are exposed as $utils service (constant) in the di module

NOTE: Specs are coming

Examples

//we create our module, passing built-in
var myModule = di.module('myModule', ['di']);

var $TestService = ['$utils', function ($utils){
  this.getAngularCallbacksCounter = function (){
    return $utils.callbacks.counter;   //same than $window.angular.callbacks.counter
  }
}];

myModule.service('$test', $TestService);
di.injector(['myModule']).invoke(['$test', function ($test){
  console.log("The callbacks counter is", $test.getAngularCallbacksCounter());
}]);

Release History

  • v0.0.2 new service in module di exposing $utils functions
  • v0.0.1 First approach

License

Copyright (c) 2012 Javier Mendiara
Licensed under the MIT license.

About

Spectacular Angular Dependency Injection for Javascript isolated as a library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published