You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi and sorry if this question has been already asked. I have checked the #38 issue but I still don't see it very clear.
I have two HTML templates that I load using <a href=""> links. I use angular-ui-router to route, so the only thing that changes when clicking the link is the content of the ui-view. Each template has a .js and .css file associated with it that I load using ocLazyLoad.
Everything goes smoothly until I decide to go back and forth between the two pages. Everytime I click a link both .js and .css files get loaded again adding two duplicate lines of code to the <head>. The app still runs without problems since it loads the component just the first time, but the files keep getting loaded making the <head> a mess.
Here is the code I use to load the files with the routing.
angular.module('miApp').config(config);functionconfig($stateProvider,$locationProvider,$urlRouterProvider,$ocLazyLoadProvider){$urlRouterProvider.otherwise("/");$stateProvider.state('testState',{url: "/mirar",templateUrl: 'views/viewTest1.html',controller: 'view1Ctrl as miCtrl',resolve: {loadMyCtrl: ['$ocLazyLoad',function($ocLazyLoad){return$ocLazyLoad.load('scripts/controllers/view1Ctrl.js');}],loadMyCSS: ['$ocLazyLoad',function($ocLazyLoad){return$ocLazyLoad.load('styles/testStyle.css');}],}}).state('testState2',{url: "/mirar2",templateUrl: 'views/viewTest2.html',controller: 'view2Ctrl as miCtrl',resolve: {loadMyCtrl: ['$ocLazyLoad',function($ocLazyLoad){return$ocLazyLoad.load('scripts/controllers/view2Ctrl.js');}],loadMyCSS: ['$ocLazyLoad',function($ocLazyLoad){return$ocLazyLoad.load('styles/testStyle.css');}],}});$locationProvider.html5Mode(true);$ocLazyLoadProvider.config({debug: true});}
Is there a solution or am I doing something wrong?
The text was updated successfully, but these errors were encountered:
Hi and sorry if this question has been already asked. I have checked the #38 issue but I still don't see it very clear.
I have two HTML templates that I load using
<a href="">
links. I use angular-ui-router to route, so the only thing that changes when clicking the link is the content of the ui-view. Each template has a .js and .css file associated with it that I load using ocLazyLoad.Everything goes smoothly until I decide to go back and forth between the two pages. Everytime I click a link both .js and .css files get loaded again adding two duplicate lines of code to the
<head>
. The app still runs without problems since it loads the component just the first time, but the files keep getting loaded making the<head>
a mess.Here is the code I use to load the files with the routing.
Is there a solution or am I doing something wrong?
The text was updated successfully, but these errors were encountered: