AngularJS file template and variables

Hi,

consider the following template:
angular.module('$module')
    .controller('${NAME}', function ($scope) {
        $scope.awesomeThings = [
            'HTML5 Boilerplate',
            'AngularJS',
            'Karma'
        ];
    });

This results in WebStorm asking me for module and scope values when creating a file from this template.

How can I define the template to leave $scope untouched when creating a file from the template?

Thanks,

Alex

0
2 comments

Hi there,

$ has a special meaning in velocity... Please see http://www.jetbrains.com/webstorm/webhelp/file-and-code-templates-2.html:
'You can prevent treating dollar characters ($) in template variables  as prefixes. If you need a dollar character ($ inserted as is, use the   ${DS} file template variable instead. When the template is applied, this  variable evaluates to a plain dollar character ($).


You need to escape $ sign by ${DS}, like this: ${DS}scope

0

Please sign in to leave a comment.