Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,44 @@
|
||||
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
|
||||
);
|
||||
});
|
||||
};
|
||||
});
|
||||
Reference in new issue
Block a user