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

controllerUrl doesn't execute controller #161

Open
riccardoroasio opened this issue Jan 28, 2016 · 0 comments
Open

controllerUrl doesn't execute controller #161

riccardoroasio opened this issue Jan 28, 2016 · 0 comments

Comments

@riccardoroasio
Copy link

Hi,

i'm trying to load a controller in this way:

   'main.toolbar@main':
         angularAMD.route({
          templateUrl:function (){ var token=$cookies.get('token'); return '/getTemplate/'+token+'/main.toolbar'; },
          controllerUrl:'/getController/'+$cookies.get('token')+'/main.toolbar.js'
        }),

The controller code is here:

define(['app','services/JSONService.js'], function (app) {

console.log("here");
app.controller('main.toolbar', function ($scope, $rootScope,$state,$mdSidenav,$location,JSONService,$cookies) {
 console.log("main.toolbar");

 $scope.toggleSidenav = function(menuId) {
    $mdSidenav(menuId).toggle();
  };

 $scope.openLink=function(url){
  $scope.toggleSidenav('left');
  if (url.substring(0, 7) == "http://")
  {
   $window.location.href = url;
  }
  else
  {
   $location.path(url);
  }
 };

 var token=$cookies.get('token');

 console.log("get partial");
 $scope.partial_url="/getPartial/"+token+"/menu-bar";

});

});

The problem is that the js is correctly loaded but the inner console.log is never fired so i think that for some reason it doesn't execute the controller.

Am I doing something wrong?

Thanks,
Riccardo

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