Skip to content

Instantly share code, notes, and snippets.

@samwx
Last active May 30, 2018 20:12
Show Gist options
  • Save samwx/ad45e3e955ab7e00b0862c92098b1482 to your computer and use it in GitHub Desktop.
Save samwx/ad45e3e955ab7e00b0862c92098b1482 to your computer and use it in GitHub Desktop.
Userful angular snippets for vscode
{
"Create angular es7 module": {
"prefix": "ng-module",
"body": [
"import * as angular from 'angular';",
"",
"// Types",
"",
"// Controllers",
"",
"// Services",
"",
"// Views",
"",
"// Constants",
],
"description": "Create a angular module boilerplate"
},
"Create angular es7 component": {
"prefix": "ng-component",
"body": [
"class ${1:ClassName} {",
"\tconstructor() {$7}",
"}",
"",
"export const ${2:ClassNameComponent} = {",
"\ttemplate: ${3:template},",
"\tcontroller: $1,",
"\tcontrollerAs: '$${4:ctrl}',",
"\tbindings: {",
"\t\t$5",
"\t},",
"\ttransclude: ${6:boolean},",
"};"
],
"description": "Create a padronized es7 component fo angular"
},
"(BETA) Create angular es7 component using decorator": {
"prefix": "ng-decorator-component",
"body": [
"import { Component } from 'decorators';",
"",
"@Component({",
"\tcontrollerAs: '$${1:ctrl}',",
"\ttemplate: ${2:template},",
"\ttransclude: ${3:boolean},",
"\tinputs: [$4],",
"\toutputs: [$5],",
"})",
"export class ${6:ClassName} {",
"\tconstructor() { }",
"}"
],
"description": "Create a padronized es7 component fo angular"
},
"Create angular es7 directive": {
"prefix": "ng-directive",
"body": [
"export class ${1:ClassName} {",
"\trestrict = '${2}';",
"",
"\tconstructor() {}",
"",
"\tlink(scope) {}",
"",
"\tstatic factory() {",
"\t\treturn new ${1:ClassName}();",
"\t}",
"}",
"",
],
"description": "Create a padronized es7 component fo angular"
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment