0
I have a project developed in Angular 1, I am using routeProvider and locationProvider. But now that the project is "ready", I need to disable the route system, IE, when the URL is changed, when I access another page, I need the page to be reloaded again.
Has anyone ever needed to disable routes to do something similar?
It follows below the system of routes that I use in the pages Routes.js:
(function () {
'use strict';
angular
.module('solicitardocumentos')
.config(Config);
function Config($routeProvider, $locationProvider) {
$routeProvider
.when('/solicitardocumentos', {
templateUrl: 'modulosolicitardocumentos/template/index.html',
controller: 'solicitardocumentosController',
controllerAs: 'vm'
});
$locationProvider.html5Mode(true).hashPrefix('!');
}
})();
Maybe it’s not clear exactly what you want, Mauritius. By 'disabling the route system', what do you mean? You only have one route. You no longer want this route to be reached if the user type 'system/#/prompt documents'? What would be the desired behavior?
– OnoSendai
My site contains 5 pages, what I mean is that when I change from one page to another, the site should be fully loaded again. What I believe is something that should be done inside the Routes.
– Maurício Krüger
I ask because if you are using a SPA framework (single page application) the idea is that you do not browse/reload the browser every change - you just change states (States).
– OnoSendai
Unfortunately the customer has requested the individual loading of the pages now that the project is ready :(which is why I would like it to be simple to change this.
– Maurício Krüger
What do you mean by reload the page? When you exchange page, the angular controller (within a file .js) is run again, so the data is recharged. Now, if the question is to reload the entire html, I believe that’s not possible, because this is a static file (just as .js and .css) that the browser can cache (depending on your settings). This is different from a page .php or .cshtml that the browser does not interpret as being static, so it does not cache it, being always requested from the server again.
– Alisson