0

Utilising ui-router I have the following state which is working fine when the visitor has navigated/activated to that state from somewhere else within the app e.g. http://www.example.com to http://www.example.com/register:

$stateProvider.state('userRegister', {
    url: '/register',
    templateUrl: 'views/site/user-register.html',
    controller: 'UserRegisterCtrl'
});

But when a visitor lands on 'http://www.example.com/register' from outside the site/app and I've served the page with the 'views/site/user-register.html' template pre-injected into the HTML, how can I prevent angular from reloading that template? I'm trying to save on http requests you see.

Many thanks

I am me
  • 131
  • 2
  • 12
  • 1
    You can use `$templateCache`. See [this](http://stackoverflow.com/questions/24658966/using-templatecache-in-ui-routers-template) answer on how to use it. – Guranjan Singh Mar 28 '17 at 17:47
  • @guranjan-singh Of course, I forgot about the templatecache. So The server could detect the `http://www.example.com/register` page and load the template into a ` – I am me Mar 28 '17 at 20:40

0 Answers0