Created
July 31, 2016 09:53
-
-
Save russellf9/8db3952620f11eff28c2af22c728b820 to your computer and use it in GitHub Desktop.
A IntelliJ Live Template to create an Angular Factory Service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template name="ngf" value="(function () { 'use strict'; /** * * @author $name$ * @date $date$ * * @name * $module$:$factoryName$ * * @param {obj} $value1$ An accessible member * @param {function} $function1$ A function the Factory returns * @param {function} $function2$ A function the Factory returns * * // define module requirements * @requires $dependancy1$ * @requires $dependancy2$ * * // define `imports` * @requires $import1$ * @requires $import2$ * * @description $description$ * Trying to follow the style guidelines from: {https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#angular-docs Angular 1 Style Guide <br> * */ // Ideally each Directive will have a unique package, so this try, catch won`t be required <br> // Each package needs to be defined in their own module <br> var module; try { module = angular.module('$module$'); } catch (err) { module = angular.module('$module$', []) } module.factory('$factoryName$', $factoryName$); $factoryName$.$$inject = ['$dependancy1$', '$dependancy2$']; function $factoryName$($import1$, $import2$) { // ==== ACCESSIBLE MEMBERS ==== var $value1$ = ''; var service = { }; service.$function1$ = $function1$; service.$function2$ = $function2$; return service; // ==== IMPLEMENTATION OF FUNCTIONS ==== function $function1$() { // implementation details go here } function $function2$() { // implementation details go here } } }()); $end$" description="An Angular Facory" toReformat="false" toShortenFQNames="true"> | |
<variable name="name" expression="user()" defaultValue="" alwaysStopAt="true" /> | |
<variable name="date" expression="date()" defaultValue="" alwaysStopAt="true" /> | |
<variable name="module" expression="" defaultValue=""module.name"" alwaysStopAt="true" /> | |
<variable name="factoryName" expression="fileNameWithoutExtension()" defaultValue="" alwaysStopAt="true" /> | |
<variable name="value1" expression="" defaultValue=""currentName"" alwaysStopAt="true" /> | |
<variable name="function1" expression="" defaultValue=""setValue"" alwaysStopAt="true" /> | |
<variable name="function2" expression="" defaultValue=""getValue"" alwaysStopAt="true" /> | |
<variable name="dependancy1" expression="" defaultValue=""module1"" alwaysStopAt="true" /> | |
<variable name="dependancy2" expression="" defaultValue=""module2"" alwaysStopAt="true" /> | |
<variable name="import1" expression="" defaultValue=""import1"" alwaysStopAt="true" /> | |
<variable name="import2" expression="" defaultValue=""import1"" alwaysStopAt="true" /> | |
<variable name="description" expression="" defaultValue=""Add a description of what your Factory Service does!"" alwaysStopAt="true" /> | |
<variable name="end" expression="" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="JAVA_SCRIPT" value="true" /> | |
</context> | |
</template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment