Created
June 27, 2016 18:38
-
-
Save UnJavaScripter/4b1fd307127ab2af91bb9e1c257b71c0 to your computer and use it in GitHub Desktop.
Visual Studio Code AngularJS Snippets
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
{ | |
// Place your snippets for JavaScript here. Each snippet is defined under a snippet name and has a prefix, body and | |
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | |
// $1, $2 for tab stops, ${id} and ${id:label} and ${1:label} for variables. Variables with the same id are connected. | |
// Example: | |
"Console log": { | |
"prefix": "c", | |
"body": [ | |
"console.log($1);" | |
], | |
"description": "Log output to console" | |
}, | |
"IIFE": { | |
"prefix": "iife", | |
"body": [ | |
"\"use strict\";", | |
"", | |
"(function(){", | |
" $1", | |
"})();" | |
], | |
"description": "II app definitionFE" | |
}, | |
"Angular App Definition": { | |
"prefix": "angular-app", | |
"body": [ | |
"\"use strict\";", | |
"", | |
"(function(){", | |
" angular", | |
" .module('$1', []);", | |
"", | |
"})();" | |
], | |
"description": "An Angular module definition" | |
}, | |
"Angular Config Definition": { | |
"prefix": "angular-config", | |
"body": [ | |
"\"use strict\";", | |
"", | |
"(function(){", | |
" function config($2) {", | |
" $3", | |
" }", | |
"", | |
" angular", | |
" .module('$1')", | |
" .config(config);", | |
"", | |
"})();" | |
], | |
"description": "An Angular config module definition" | |
}, | |
"Angular Module": { | |
"prefix": "angular-module", | |
"body": [ | |
"\"use strict\";", | |
"", | |
"(function(){", | |
" function $3() {", | |
" $4", | |
" }", | |
"", | |
" angular", | |
" .module('$1')", | |
" .$2('$3', $3);", | |
"", | |
"})();" | |
], | |
"description": "An Angular generic module definition" | |
}, | |
"Angular Component": { | |
"prefix": "angular-component", | |
"body": [ | |
"\"use strict\";", | |
"", | |
"(function(){", | |
"", | |
" function ctrlFn() {", | |
" console.log(this.name);", | |
" }", | |
"", | |
" angular", | |
" .module('$1')", | |
" .component('$2', {", | |
" bindings: {", | |
" name: '@'", | |
" },", | |
" controller: ctrlFn,", | |
" template: ($element, $attrs) => `", | |
" <div>{{$ctrl.name}}</div>", | |
" `", | |
" });", | |
"})();" | |
], | |
"description": "An Angular Component" | |
}, | |
// UI Router | |
"UI Router - Route": { | |
"prefix": "angular-ui.router:route", | |
"body": [ | |
"$stateProvider", | |
" .state('$1', {", | |
" \"url\": '/$1',", | |
" \"templateUrl\": '$2',", | |
" \"controllerAs\": 'vm'", | |
" })" | |
], | |
"description": "An Angular UI Router route" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment