I have tried numerous solutions and tutorials already with no success in finding the right answer. Therefore, I am posting here in hopes of receiving a fresh perspective and a little challenge.
Using:
angular
ui router
The Issue
I have set up different states with unique URLs. When I click on a link (ui-sref), the state and URL change correctly. However, when I manually enter a URL (e.g., "localhost:8080/user") and press 'Enter' on my keyboard, the current state switches to an 'empty state' with nothing displayed, despite the URL being correct.
Snippet of Code
Configuration:
'use strict';
angular.module('divohon-app').config(function ($stateProvider, $urlRouterProvider, $locationProvider) {
$locationProvider.html5Mode({
enabled: true,
requireBase: false
});
$stateProvider
.state("user-home", {
url: "user",
templateUrl: "/resources/html/template/user-home.html",
controller: "UserHome",
controllerAs: "uhCtrl"
})
.state("admin-home", {
url: "admin",
templateUrl: "/resources/html/template/admin-home.html",
controller: "AdminHome",
controllerAs: "ahCtrl"
})
.state("login", {
url: "login",
templateUrl: "/resources/html/template/login.html",
controller: "LoginController",
controllerAs: "lCtrl"
});
});
Any help or references would be greatly appreciated. Thank you!