Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TJNevis/fb9f316ecf058f4950fa to your computer and use it in GitHub Desktop.
Save TJNevis/fb9f316ecf058f4950fa to your computer and use it in GitHub Desktop.
{
"completions":
[
{ "trigger": "ng-new-module", "contents": "(function( angular ) {\n\n\tangular.module('${1:NewModuleName}', ['${2:OptionalDependencyList}'])\n\n\t$3\n\n}( angular ) );" },
{ "trigger": "ng-existing-module", "contents": "(function( angular ) {\n\n\tangular.module('${1:ExistingModuleName}')\n\n\t$2\n\n}( angular ) );" },
{ "trigger": "ng-constant-inline", "contents": ".constant('$1', '$2')" },
{ "trigger": "ng-controller", "contents": ".controller('$1', [${2/(?:.+)/'/g}${2/,[ ]*/', '/g}${2/(?:.+)/', /g}function ($2) {\n\t$3\n}])" },
{ "trigger": "ng-directive-inline", "contents": ".directive('$1', [${2/(?:.+)/'/g}${2/,[ ]*/', '/g}${2/(?:.+)/', /g}function ($2) {\n\n\treturn {\n\n\t\tlink: function(scope, element, attributes, controllers) {\n\n\t\t\t$3\n\n\t\t},\n\n\t\treplace: ${4:false},\n\n\t\trestrict: '${5:AE}',\n\n\t\tscope: {\n\t\t\t$6\n\t\t},\n\n\t\ttemplateUrl: '$7'\n\n\t}\n\n}])" },
{ "trigger": "ng-factory-inline", "contents": ".factory('$1', [${2/(?:.+)/'/g}${2/,[ ]*/', '/g}${2/(?:.+)/', /g}function ($2) {\n\n\treturn {\n\n\t\t$4\n\n\t}\n\n}])" },
{ "trigger": "ng-filter-inline", "contents": ".filter('$1', [${2/(?:.+)/'/g}${2/,[ ]*/', '/g}${2/(?:.+)/', /g}function ($2) {\n\n\treturn function(input) {\n\n\t\treturn ${3:input};\n\n\t}\n\n}])" },
{ "trigger": "ng-service-inline", "contents": ".service('$1', [${2/(?:.+)/'/g}${2/,[ ]*/', '/g}${2/(?:.+)/', /g}function ($2) {\n\n\treturn {\n\n\t\t${3:// Remember to use this. for methods, Ex) this.getMethod = function() { \\}}\n\t\t$4\n\n\t};\n\n}]);" },
{ "trigger": "ng-provider-inline", "contents": ".provider('$1', [${2/(?:.+)/'/g}${2/,[ ]*/', '/g}${2/(?:.+)/', /g}function ($2) {\n\n\n\t// Factory\n\tthis.\\$get = [${3/(?:.+)/'/g}${3/,[ ]*/', '/g}${3/(?:.+)/', /g}function ($3) {\n\n\t\treturn {\n\n\t\t\t$4\n\n\t\t}\n\n\t}];\n\n\t// Provider - use var = for variables, this. for methods\n\t$5\n\n}])" },
{ "trigger": "ng-value-inline", "contents": ".value('$1', '$2')" }
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment