ng-co

0.1.2 • Public • Published

ng-co

Generator based ng-controller inspired by the famous co

Install

npm install ng-co --save

Usage

Import

require('ng-co');

angular.module('my-module', ['ng-co'])
	.controller('myFirstCtrl', ['$co', '$scope',function($co, $scope) {
		$co(function*() {
			var data = yield $http.get('/users');
			$scope.data = data;
		});
	}]);

Convert a controller

var coc = require('ng-co');

function *ctrlFun($co, $http){ 
	var vm = this;
	vm.data = yield $http.get('/list');
}

//Important ! the $co dependency is required and MUST be the first!
mymodule.controller('myCtrl',['$co','$http',coc(ctrlFun)])

Readme

Keywords

none

Package Sidebar

Install

npm i ng-co

Weekly Downloads

5

Version

0.1.2

License

MPL

Last publish

Collaborators

  • dogeek