Files
qt5-legatus-legacy/Lts/Plugins/PresentationManagement/Gui/Script/Common/thp/main.js
T
2026-08-13 18:33:10 +02:00

45 lines
1.5 KiB
JavaScript
Executable File

const dataSource = "data.json"; // JSON input file
angular
.module("main", [])
.controller("ctrl", ($scope, $http, $rootScope, $location) => {
$scope.showTable = false;
$scope.sPresentation = undefined;
$scope.strCheck = str => {
return str == "" || str == undefined || str == null
? "N/A"
: str;
};
$http.get(dataSource).then(response => {
$scope.data = response.data;
$rootScope.title = $scope.strCheck($scope.data.title);
$scope.$watch(
() => location.hash,
value => {
if (value == "" || value == undefined || value == null || value == "#!/") {
$scope.showTable = false;
$scope.sPresentation = undefined;
$rootScope.title = $scope.strCheck(
$scope.data.title
);
} else {
$scope.displayTable($location.hash());
}
}
);
});
$scope.displayTable = path => {
$http.get(path).then(response => {
$location.hash(path);
$scope.sPresentation = response.data;
$scope.showTable = true;
$rootScope.title = $scope.strCheck(
$scope.sPresentation.title
);
});
};
});