J
jts-law
Guest
Rado, I have not been able to successfully override the side navigation. I created a new side navigation controller as you suggested. If I leave the templateURL populated, then when I set the template later I get the "Uncaught Error: only one instance of babel-polyfill is allowed" error. I also tried setting up a resolve function. I've tried using the resolve with and without my custom controller and I get the same results. I don't get any errors but the menu is never rendered. The following is the main part of the code for the resolve. In jtsNav.run: if (state && state.views && state.views['side-navigation'] ) { console.log('jtsNav side-navigation setup: Parameters, calling getMenus()'); // state.views['side-navigation'].controller = JTSSideNavigationCtrl; state.views['side-navigation'].templateUrl = ''; state.views['side-navigation'].template = ''; state.views['side-navigation'].resolve = { rslv1: resolve }; } // if (state && state.views && ...) After export: var resolve = ($q, jtslibService, $state) => { console.log('jtsNav->resolving...'); let deferred = $q.defer(); /* Send request to get menus */ jtslibService.getMenus().then( (res) => { console.log('jtsNav->resolve(): ttMenus set successful'); let htmlMenu = setupSideNav(jtslibService.ttMenus); let defState = $state.get('module.default'); defState.views['side-navigation'].template = htmlMenu; deferred.resolve({template: htmlMenu}); console.log('jtsNav->resolve(): resolved'); }, // getMenus() successful (res) => { console.log('jtsNav->resolve(): ttMenus set failed.'); deferred.reject(); } // getMenus() failed ) // jtslibService.getMenus().then() return deferred.promise; }; // resolve Based on what I've found, it appears that using the resolve is what I'm going to need to do but I'm not quite there yet. I noticed that if I set state.views['side-navigation'].template to a short hard coded menu instead of blank, this is what gets rendered, even though the template value is getting set to the full menu. When I set the template to blank, this is what is rendered. Since the side-navigation renders before the new template gets generated, how do I force it to re-render after setting the template? Louis
Continue reading...
Continue reading...