I'm trying to get ui.router to work with the following setup.
export class Router { /* tslint:disable no-unused-variable */ private static $inject: string[] = ["$stateProvider", "$urlRouterProvider", "$locationProvider"]; /* tslint:enable no-unused-variable */ constructor($state: ng.ui.IStateProvider, $urlRouter: ng.ui.IUrlRouterProvider, $location: ng.ILocationProvider) { $urlRouter.otherwise("/"); $state.state("default", { url: "/", views: { "header": { templateUrl: "/views/layout/header.html" }, "sidebar": { templateUrl: "/views/layout/side-menu.html" }, "": { templateUrl: "/views/workspace/index.html" }, "footer": { }, } }); $location.html5Mode(true); } } Here is the partial file I'm using.
<div id="workspace"> <div id="workspace-header"> <div data-ui-view="header"></div> </div> <div id="workspace-container"> <div> <div data-ui-view="sidebar"></div> </div> <div> <div> <div> <div id="workspace-view"> <div data-ui-view></div> </div> <div id="workspace-footer"> <div data-ui-view="footer"></div> </div> </div> </div> </div> </div> </div> I'm not sure it's related (or whether it's a problem) but the html above is injected using ng-include like so.
<div id="dashboard" data-ng-include="'/views/master.html'" data-prevent-touch-scroll></div> Just to be clear I verified that the router gets called.
I thought that 'otherwise' would navigate to the url and it would transit into the default state which will inject the partial views but it doesn't seems to work, I'm sure I'm missing something but I cannot figure it out.