1.0.3 • Published 9 years ago

angular-di v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
9 years ago

angular-di

Decouple your ES6 code from the AngularJS

Why

With a better tooling, like browserify, babel and karma, you can write faster tests with total control of your units.

Example

Let's write a service

import { di } from 'angular-di';
import { FooService } from 'app/foo.service'

class FooService {
	constructor($http, $q) { }
}

// annotations to protect from minifier problems
di.inject(FooService, '$http, $q')

And a controller

class HomeController {
	constructor(FooService) {
		this.service = FooService;
	}

	// ...
}

Write a file to import your stuff

import { di } from 'angular-di';

// external dependencies
import uiRouter from 'angular-ui-router';

import { routes } from 'src/routes';
import { FooService } from 'src/foo.service';

// declare app and his dependencies
let app = di.module([ 'ui.router' ]);

app.service({ FooService });

// declares the routes into ui.router
app.routes(routes);

app.onConfig(() => {
    // configure
});

app.onRun(() => {
    // run
});

app.run(document.body);

Routes

let routes = {
	'app': {
		url: '',
		templateUrl: 'index.html'
	},
	'app.home': {
		templateUrl: 'home.html',
		controller: 'HomeController'
	}
}
1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.2.6

10 years ago

0.2.5

10 years ago

0.2.4

10 years ago

0.2.3

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.0

10 years ago