requirejs + angularjs + resolve, controller loaded but not executed -
i'm trying load dynamically controller in way:
.state('main', { url:'/app', data: {requirelogin:true }, views:{ '': angularamd.route({ templateurl:function (){ var token=$cookies.get('token'); return '/gettemplate/'+token+'/main'; }, controller:'' }), 'main.content@main': angularamd.route({ templateurl:function (){ var token=$cookies.get('token'); return '/gettemplate/'+token+'/main.content'; }, // controller:'main.content', resolve: { load: ['$q', '$rootscope', '$cookies',function ($q, $rootscope, $cookies) { var controller_name='main.content.js'; return loadcontrollerwithtoken($q,$rootscope,$cookies,controller_name);}]} }),
the controller loaded (i'm checkin network panel on chrome) not "executed", console.log inside isn't called.
here controller:
define(['app','services/jsonservice.js'], function (app) { console.log("here"); app.register.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"; }); });
what i'm missing?
thanks, riccardo
Comments
Post a Comment