Last active
January 10, 2017 22:15
-
-
Save peabnuts123/518d25e6d0913986fb6d to your computer and use it in GitHub Desktop.
Visual Studio CodeSnippet for JavaScript. AngularJS controller definition
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
<?xml version="1.0" encoding="utf-8"?> | |
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> | |
<CodeSnippet Format="1.0.0"> | |
<Header> | |
<SnippetTypes> | |
<SnippetType>Expansion</SnippetType> | |
</SnippetTypes> | |
<Title>Angular Controller</Title> | |
<Author>Jeff Andrews</Author> | |
<Description>Creates an angular controller with reference to a module and adds a route</Description> | |
<HelpUrl> | |
</HelpUrl> | |
<Shortcut>ngcontroller</Shortcut> | |
</Header> | |
<Snippet> | |
<Declarations> | |
<Literal Editable="true"> | |
<ID>controllerName</ID> | |
<ToolTip>Controllername</ToolTip> | |
<Default>myController</Default> | |
<Function> | |
</Function> | |
</Literal> | |
<Literal Editable="true"> | |
<ID>moduleName</ID> | |
<ToolTip>Modulename</ToolTip> | |
<Default>myModule</Default> | |
<Function> | |
</Function> | |
</Literal> | |
</Declarations> | |
<Code Language="JavaScript"> | |
<![CDATA[(function $controllerName$Controller(angular) { | |
var module = angular.module('$moduleName$'); | |
Route.addRoute({ | |
route: '$controllerName$', | |
templateUrl: 'components/$moduleName$/$controllerName$.html', | |
controller: '$controllerName$Ctrl' | |
}); | |
module.controller('$controllerName$Ctrl', [$controllerName$CtrlFunction]); | |
function $controllerName$CtrlFunction() { | |
var ctrl = this; | |
ctrl.test = "I am the $controllerName$ controller"; | |
} | |
})(angular);]]></Code> | |
</Snippet> | |
</CodeSnippet> | |
</CodeSnippets> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment