gen-ng-component
v1.0.0
Published
A micro cli app to generate angularjs component according to John Papa's styleguide
Downloads
3
Readme
gen-ng-component
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', []);
})();