node package manager
We need your input. Help make JavaScript better: Take the 2017 JavaScript Ecosystem survey »

generator-ng-module

generator-ng-module

A generator for Yeoman.

Description

A Yeoman generator for quickly getting (very opinionated) Angular modules going.

These modules utilize the following design pattern and are designed to be used with require.js. These modules also utilize ui.router, although that can easily be removed.

(function() {
    'use strict';
 
    var moduleName = 'fooModule',
 
        angularDependencies = [];
 
    define([
        'angular'
    ], function(angular) {
 
        var module = angular.module(moduleName, angularDependencies);
 
        module.config(['$stateProvider',
            function($stateProvider) {
 
                $stateProvider.state('foo', {
                    controller: 'fooCtrl',
                    url: '/foo',
                    templateUrl: 'path/to/foo/_foo.html'
                });
            }
        ]);
 
        module.controller('fooCtrl', ['$scope', '$state',
            function($scope, $state) {
                // stuff 
            }
        ]);
 
        return module;
    });
})();

Getting Started

$ npm install -g yo

Installation

To install generator-ng-module from npm, run:

$ npm install -g generator-ng-module

Finally, initiate the generator:

$ yo ng-module

License

MIT License