I have this class that handles orientation change
class TimesheetController extends BaseController < ViewModels.MenuViewModel > implements ITimesheetController {
//#region Injections
public static $inject = [
Inject.Scope,
Inject.Injector,
Inject.RootScope,
Inject.StateService,
Inject.RotationService,
Inject.Window
];
//#endregion
constructor($scope: ng.IScope, $injector: ng.auto.IInjectorService) {
super($scope, ViewModels.MenuViewModel, $injector);
window.addEventListener("orientationchange", (ev: Event) => {
this.$stateService.reload();
});
}
//#region Page Events
public destroy(): void {
}
//#endregion
}
I have this route that I want to reload each time someone changes orientation.
$stateProvider.state("app.timesheet", {
url: "/timesheet",
views: {
"menuContent": {
templateUrl: () => {
var orientation: number = ( < any > window).orientation;
if (orientation === 90 || orientation === -90) { // Landscape
return "views/timesheet/landscape.html"
} else if (orientation === 0 || orientation === 180 || orientation === -180) { // Portrait
return "views/timesheet/portrait.html";
}
},
controller: "TimesheetController"
}
}
});
I tried every thing, nothing helped - no reloading from portrait to landscape.