67 lines
2.2 KiB
Plaintext
67 lines
2.2 KiB
Plaintext
|
// create the controller and inject Angular's $scope
|
||
|
scotchApp.controller('mainController',
|
||
|
// create a message to display in our view
|
||
|
function($scope ,$location ,$templateCache,mainPostFactory,commonService) {
|
||
|
|
||
|
//alert("mainController");
|
||
|
init();
|
||
|
|
||
|
function init() {
|
||
|
//$location.path("/");
|
||
|
try{
|
||
|
|
||
|
// var actLoadData = $.ajax(doGetPath('/json/doCheckLogin.json'),
|
||
|
// {
|
||
|
// ajax: true,
|
||
|
// dataType: 'json',
|
||
|
// type: "POST"
|
||
|
// }).error(
|
||
|
// function (data) {
|
||
|
// $location.path("/login");
|
||
|
// $scope.$apply();
|
||
|
// });
|
||
|
//
|
||
|
// actLoadData.success(
|
||
|
// function (data) {
|
||
|
//// $location.path("/");
|
||
|
// $scope.$apply();
|
||
|
// }
|
||
|
// );
|
||
|
// alert("mainController");
|
||
|
// mainPostFactory.doCheckLogin().success(
|
||
|
|
||
|
mainPostFactory.doAjaxPost('/json/doCheckLogin.json',{}).success(
|
||
|
function () {
|
||
|
// alert(commonService.urlPath);
|
||
|
// commonService.setDv(data[0]);
|
||
|
// alert(commonService.dv);
|
||
|
// $location.path(commonService.urlPath);
|
||
|
$location.path("/logout");
|
||
|
$scope.$apply();
|
||
|
}
|
||
|
).error(
|
||
|
function () {
|
||
|
$location.path("/login");
|
||
|
$scope.$apply();
|
||
|
});
|
||
|
}catch(e){
|
||
|
//
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// $scope.printing = function(url){
|
||
|
// //alert("printing");
|
||
|
// $scope.urlPath = url;
|
||
|
// $location.path(url+"/"+new Date().getTime());
|
||
|
// $scope.$apply();
|
||
|
// };
|
||
|
//
|
||
|
// $scope.redirectMainPage = function(url){
|
||
|
// $location.path(url+"/"+new Date().getTime());
|
||
|
// $scope.$apply();
|
||
|
// };
|
||
|
//
|
||
|
// $scope.doLogout = function () {
|
||
|
// $location.path("/logout");
|
||
|
// };
|
||
|
});
|