Skip to content

Instantly share code, notes, and snippets.

@toepoke
Last active June 3, 2016 11:55
Show Gist options
  • Save toepoke/8430072d53ec564ca7ea to your computer and use it in GitHub Desktop.
Save toepoke/8430072d53ec564ca7ea to your computer and use it in GitHub Desktop.
FCC Angular2 VS Code snippets
{
/*
// Place your snippets for TypeScript 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:
"Print to console": {
"prefix": "log",
"body": [
"console.log('$1');",
"$2"
],
"description": "Log output to console"
}
*/
"Angular2 Component": {
"prefix": "fccng2component",
"description": "FCC Angular2 Component template",
"body": [
"// snippet gist: https://gist.github.com/toepoke/8430072d53ec564ca7ea",
"import { Component, EventEmitter, Input, Output, OnInit } from '@angular/core';",
"",
"@Component({",
"\tselector: '${1:selector}', ",
"\tdirectives: [],",
"\ttemplate:`",
"\t\t<p>Our Component</p>",
"`,",
"})",
"",
"export class ${2:name} implements OnInit {",
"// @Input() someInput: boolean = false;",
"// @Output() someOutput: EventEmitter = new EventEmitter();",
"$0",
"\tconstructor() {",
"\t\t// To trigger the @Output emitter, use:",
"\t\t// this.someOutput.emit({ some: data });",
"\t}",
"",
"\tngOnInit() {",
"",
"\t}",
"}",
""
]
},
"Angular2 Ionic Component": {
"prefix": "fccng2iopage",
"description": "FCC Angular2 Component template",
"body": [
"// snippet gist: https://gist.github.com/toepoke/8430072d53ec564ca7ea",
"import {Page, NavController} from 'ionic-angular';",
"",
"@Page({",
"\ttemplate:`",
"\t\t<ion-navbar *navbar>",
"\t\t\t<ion-title>",
"\t\t\t\tMy Page",
"\t\t\t</ion-title>",
"\t\t</ion-navbar>",
"",
"\t\t<ion-content>",
"\t\t\t<p>My Page</p>",
"\t\t",
"\t\t</ion-content>",
"`,",
"})",
"",
"export class ${1:name} {",
"\t_nav: NavController = null;",
"",
"\tconstructor(nav: NavController) {",
"\t\tthis._nav = nav;",
"\t}",
"",
"}",
""
]
}
}
@toepoke
Copy link
Author

toepoke commented Apr 11, 2016

Jun 03 2016 Update:

Updated to Ag2RC1 code

Apr 11 2016 Update:

Removed "_references.ts" - replaced by typings.
Removed import of "View" - deprecated from Angular2 codebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment