I am creating an AngularJS application and I am having problems with the URL when creating the second view:
My appContact.js looks like this:
(function () { "use strict"; var app = angular.module("appContacts", ["simpleControls", "ngRoute"]) .config(function ($routeProvider, $locationProvider) { $routeProvider.when("/", { controller: "contactsController", controllerAs: "vm", templateUrl: "/views/contactsView.html" }); $routeProvider.when("/details/:firstName", { controller: "contactsDetailsController", controllerAs: "vm", templateUrl: "/views/detailsView.html" }); $routeProvider.otherwise({ redirectTo: "/"}); $locationProvider.html5Mode({ enabled: true, requireBase: false }); }); })();
In my HTML, I have this link:
<a asp-controller="Contact" asp-action="Details" ng-href="#/details/{{contact.firstName}}" >{{ contact.firstName}}</a>
When I am in the browser, I have the correct suggested link, for example:
**http://localhost:8000/
But when I click the link to go to a new page, the URL changes to
**http://localhost:8000/
Changing "/" to% 2 makes the application fail and a blank page is displayed.
Do you know why this is and how to fix this problem?
I already read similar messages, but none of them seem to work, since I do not have access to the encoded URL before it reaches the browser, and there is an error there.
thanks
Raphael