angularjs template cache lazy loading with permissions -


I am not using an angle scene or router. Simply include ng-I, ng-include (initializing templates with the dummy divis) and after getting a template from the server and updating the template cache, lazy loads in updating and updating it Was happening. The problem was most of the time template, where it was not updated. Apart from this, I want the user to see the template, if the user has permission. Permissions will be checked on the server.

What is the best way to achieve this?

I found the following solutions from the following

// CacheTemplate buster. // // Clearing on successful passage changes (see later) // previous page template from the cache, as if the application sends another request to // server, in exchange for a copy of // access rights Opportunity is user / session $ scope.tc = $ templateCache;

  $ Rootscope. $ ('$ RouteChangeSuccess', function (event, next, current) {switch ($ location.path ()) {Case '/ login': $ window.document.title = "LOGIN"; $ scope.loggedIn = false; Break; case '/ home': $ window.document.title = "HOME"; $ scope.loggedIn = true; paused; default: $ window.document.title = ""; $ scope.loggedIn = false; break;} ; // Clear cache // to reload (if the server is allowed or not) if (Current & amp; Amp; Crane T. Way) {if ($ scope.tC.get (current. $ Route.templateUrl)) {$ scope.tC.remove (current. $ Route.templateUrl);};};}); ...  

Comments