Can someone tell me if my settings are off. I created a registration page so that when the user hits submit, user gets redirected to the login page.
Here is my script:
<script type="text/javascript">
app.controller('regController', function ($scope, $location, $http) {
$scope.submitForm = function (isValid) {
if (isValid) {
$http({
method: 'POST',
url: '/RegModule/Account/Registration',
data: $scope.regData,
headers: { 'Content-Type': 'application/json' }
}).success(function (data, status, headers, config) {
$location.path('@Url.Action("Home/Home/Login")');
}).error(function (data, status, headers, config) {
})
}
}
})
</script>
Here is my app.config
var app = angular.module('MyApp', ["ngRoute"])
.config(function ($routeProvider, $locationProvider) {
$routeProvider
.when("/Login", {
templateUrl: "Home/Home/Login",
controller: 'registrationController'
});
$locationProvider.html5Mode(true);
});
The problem I am running into is $location.path keeps appending the path I want to the current url instead of rewriting the whole path. For example, my current url is https://localhost/RegModule/Account/Registration. When the user hits submit, I tell it in the success method to redirect to https://localhost/Home/Home/Login. Instead my link ends up as: http://localhost/RegModule/Account/Registration#/Home/Home/Home/Home/Login
I've been googling this for the past 2 days and I can't figure out where my problem lies. Does anyone have any thoughts? Maybe i'm missing a setting i'm supposed to apply? I like to add in that that I am using ASP.NET MVC 5 behind the scenes.