Ui-router minification templateUrl?

I have this code:

['$locationProvider', '$sceDelegateProvider', '$sceProvider', '$stateProvider', function ($locationProvider, $sceDelegateProvider, $sceProvider, $stateProvider) {

    var access = {
        name: 'access',
        url: '/Access/:content',
        templateUrl: ['$stateParams', function ($stateParams) {
            var x = $stateParams;
            var page = 'app/access/partials/' + $stateParams.content + '.html';
            return page;


I did what I thought it took to make this work when it was minified, but it looks like AngularJS cannot resolve $stateParams


Has anyone faced a similar problem?


source to share

1 answer


property takes a string or function and the function only takes one parameter which is toParams

- it doesn't support injection parameters.

In your case, assign the function directly without an array:

.state("access", {
   // ...
   templateUrl: function(toParams){
      var page = 'app/access/partials/' + toParams.content + '.html';
      return page;




All Articles