marcoslin / angularAMD

Facilitate use of RequireJS in AngularJS
http://marcoslin.github.io/angularAMD
MIT License
734 stars 171 forks source link

Dynamic controller name? #121

Closed sayakb closed 9 years ago

sayakb commented 9 years ago

I'm trying to resolve the name of my controller and view dynamically (I am using angularAMD + ui-router):

$stateProvider
    .state('default', angularAMD.route({
        url: '/:module/:action?id',

        templateUrl: function (params) {
            var module = params.module;
            var action = module + params.action.charAt(0).toUpperCase() + params.action.substr(1);

            return 'app/views/' + module + '/' + action + 'View.html';
        },

        controller: 'userController',
    }));

While the above code works, I am unable to find a way to dynamically determine the controller name. Is there any way to do that?

sayakb commented 9 years ago

Thought this is better suited for stackoverflow, so I posted it there.