1
I need to type in the Browse...
dominio.com.br/details/1234
...and I need the controller to take this 1234 number and perform your task. I tried everything unsuccessfully.
NOTE: If I create an anchor inside the page linking href the route (<a href="#/detalhes/1234">Rodar Controller</a>
) and click on this link, it works normally, but I need it to work by typing in Browse.
Follow my route definition and controller:
angular.module('confirmar.routers', ['ngRoute'])
.config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) {
$routeProvider
.when('/detalhes/:id', {
controller: 'DetalhesController'
})
.otherwise({redirectTo: '/'});
$locationProvider.html5Mode(true).hashPrefix('!');
}])
.controller('DetalhesController',['$routeParams', function ($routeParams) {
console.log('Detalhes exibido sobre o código: ' + $routeParams.id);
}]);
I need it to work by typing in Browse because the customer will receive an email with the link: http://www.dominio.com.br/detalhes/<seu codigo>
and when it clicks on this link, it will open the Browse displaying the item details <seu codigo>
missing you inform base https://docs.angularjs.org/guide/$Location look at relative links, it says: Relative links Be sure to check all relative links, images, scripts etc. Angular requires you to specify the url base in the head of your main html file (<base href="/my-base/index.html">) unless html5Mode.requireBase is set to false in the html5Mode Definition Object passed to $locationProvider.html5Mode(). With that, relative urls will Always be resolved to this base url, Even if the initial url of the Document was Different.
– Fabrício Santos