Skip to content

Instantly share code, notes, and snippets.

@JeffryGonzalez
Created September 28, 2016 17:00
Show Gist options
  • Select an option

  • Save JeffryGonzalez/03d736aad4e485b1b04295ca759d6c08 to your computer and use it in GitHub Desktop.

Select an option

Save JeffryGonzalez/03d736aad4e485b1b04295ca759d6c08 to your computer and use it in GitHub Desktop.
{
"Angular Controller": {
"prefix": "ngcontroller",
"body": [
"angular",
"\t.module('${Module}')",
"\t.controller('${Controller}Controller', ${Controller}Controller);",
"",
"${Controller}Controller.$inject = ['${dependency1}'];",
"function ${Controller}Controller(${dependency1}) {",
"\tvar vm = this;",
"\t$0",
"",
"\tactivate();",
"",
"\t////////////////",
"",
"\tfunction activate() { }",
"}",
],
"description": "Angular 1 controller"
},
"Angular Service": {
"prefix": "ngservice",
"body": [
"angular",
"\t.module('${Module}')",
"\t.service('${Service}', ${Service});",
"",
"${Service}.$inject = ['${dependency1}'];",
"function ${Service}(${dependency1}) {",
"\tthis.${exposedFn} = ${exposedFn};",
"\t$0",
"\t////////////////",
"\tfunction ${exposedFn}() { }",
"}",
],
"description": "Angular 1 service"
},
"Angular Factory": {
"prefix": "ngfactory",
"body": [
"angular",
"\t.module('${Module}')",
"\t.factory('${Service}', ${Service});",
"",
"${Service}.$inject = ['${dependency1}'];",
"function ${Service}(${dependency1}) {",
"\tvar service = {",
"\t\t${exposedFn}:${exposedFn}",
"\t};",
"\t$0",
"\treturn service;",
"",
"\t////////////////",
"\tfunction ${exposedFn}() { }",
"}",
],
"description": "Angular 1 factory"
},
"Angular Directive": {
"prefix": "ngdirective",
"body": [
"angular",
"\t.module('${Module}')",
"\t.directive('${Directive}', ${Directive});",
"",
"${Directive}.$inject = ['${dependency1}'];",
"function ${Directive}(${dependency1}) {",
"\t// Usage:",
"\t//",
"\t// Creates:",
"\t//",
"\tvar directive = {",
"\t bindToController: true,",
"\t controller: ${Controller}Controller,",
"\t controllerAs: '${vm}',",
"\t link: link,",
"\t restrict: 'A',",
"\t scope: {",
"\t }",
"\t};",
"\treturn directive;",
"\t",
"\tfunction link(scope, element, attrs) {",
"\t}",
"}",
"/* @ngInject */",
"function ${Controller}Controller () {",
"\t$0",
"}",
"})();"
],
"description": "Angular 1 directive"
},
"Angular Module": {
"prefix": "ngmodule",
"body": [
"",
"angular.module('${module}', [",
"\t$0",
"]);"
],
"description": "Angular 1 module"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment