I have a login form, once the user filled the username
and password
i am redirecting them to home
page.
for that i do like this:
$scope.submitLogin = function (valid) {
if(!valid) return;
var data = $scope.login;
$location.url('/home'); //redirecting to home page.
}
works fine. But after landing to that page, in case of refresh
the page, the url is still exist as http://localhost:3000/home
- but instead of loading the page i am getting message as Cannot GET /home
- what is the problem here?
How to fix this? or what is the mistake i do here? any one help me to sort this please?
Thanks in advance.
UPDATE
Here is my root provider for reference:
(function () {
"user strict";
angular.module("tcpApp", ["ngRoute","ngResource", "ngAnimate"])
.config(function ($routeProvider, $locationProvider) {
$locationProvider.html5Mode(true);
$routeProvider
.when ("/", {
templateUrl : "views/login/login.html",
controller : "loginController"
});
$routeProvider
.when ("/home", {
templateUrl : "views/home/home.html",
controller : "homeController"
});
$routeProvider
.otherwise ({
redirectTo:'/'
});
})
})();