Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic variable transformation #51

Open
dvdln opened this issue Aug 11, 2014 · 1 comment
Open

Automatic variable transformation #51

dvdln opened this issue Aug 11, 2014 · 1 comment

Comments

@dvdln
Copy link

dvdln commented Aug 11, 2014

Would love to see a way to automatically change case of certain instances of variables.

For instance:

(function () {
    'use strict';

    angular
        .module('$${module}')
        .directive('$${directive}', $${directive}Config);

    function $${directive}Config() {
        return {
            controller: $${directive:upperCamelCase}Ctrl,
            link: $${directive}Link,
            restrict: '__EA__',
            templateUrl: '$${templatePath}/$${directive:dashCase}.directive.html'
        };

        function $${directive}Link(scope, element, attrs, ctrl) {
        }
    }

    /**
     * @ngInject
     */
    function $${directive:upperCamelCase}Ctrl($scope) {
    }
}());

Perhaps with upperCamelCase, camelCase, and dashCase as default filters and allow developers to specify their own JavaScript filters.

@dvdln
Copy link
Author

dvdln commented Aug 11, 2014

Or, optionally, be able to specify callbacks as tokens and pass the functions a hash of user input:

{
     controller: $${getControllerName},
     link: $${directive}
}

With a callback:

function getControllerName(input) {
    return convertToCamelCase(input.directive);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant