1.0.0 • Published 6 years ago

gen-ng-component v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

gen-ng-component

Build Status

This micro-app generates an angularjs component according to John Papa's styleguide.

Installation

npm -g install gen-ng-component

Usage

gen-ng-component {moduleName} {componentName} {path}

Example

gen-ng-component app.main detailsList

^^ This line will generate the following files:

detailsList
    ├── detailsList.component.js
    ├── detailsList.controller.js
    ├── detailsList.html
    └── detailsList.module.js

detailsList.component.js

/**
 * @desc detailsList component
 * @namespace Components
 */
(function() {

    'use strict';
    
    angular
        .module('app.main.detailsList')
        .component('detailsList', {
            bindings: {
            },
            templateUrl: 'detailsList/detailsList.html',
            controller: 'DetailsListController as vm',
        });

})();

detailsList.controller.js

/**
 * @desc detailsList component
 * @namespace Controllers
 */
(function() {

    'use strict';
    
    angular
        .module('app.main.detailsList')
        .controller('DetailsListController', DetailsListController);

    /**
     * @name DetailsListController
     * @desc detailsList controller
     * @constructor
     * @ngInject
     */
    function DetailsListController() {
        const vm = this;
    }

})();

detailsList.html

<!-- detailsList component -->
<section class="details-list">
    <!-- detailsList contents -->
</section>
<!-- /detailsList component -->

detailsList.module.js

/**
 * @desc detailsList component
 * @namespace Modules
 */
(function() {

    'use strict';
    
    angular
        .module('app.main.detailsList', []);

})();