angular.module('starter.controllers', [])

.controller('loginCtrl',["$scope",'$state',function($scope,$state){
	$scope.vm = {
		mobile:'',
		password:''
	};
	$scope.login = function(){
		if($scope.vm.username == 'admin' && $scope.vm.password == 'admin'){
			$state.go('home')
		}else{
//			$scope.showAlert = function(){
//				var alertPopup = $ionicPopup.alert({
//					title:'账号密码不正确',
//					template:'唯一账号密码---admin'
//				})
//			}
				alert('账号密码不正确')
		}
	}
	
	
}])

.controller('homeCtrl',["$scope",'$http','$timeout',function($scope,$http,$timeout){
	$scope.excals = [
		{'list':'测试一'},
		{'list':'测试二'},
		{'list':'测试三'}
	];
	$scope.doRefresh = function(){
		 $http.get('../lib/ionic/test.json')  
            .success(function(newItems) {
                $scope.excals = newItems;
            })
            .finally(function() {
                $scope.$broadcast('scroll.refreshComplete');
            });
	}
}])
//展示首页控制器
.controller('lineCtrl',["$scope",'$ionicHistory','$state',function($scope,$ionicHistory,$state){
	$scope.go = function(target){
		$ionicHistory.clearHistory();
		$state.go(target)
	}
}])
//TN曲线控制器
.controller('tnCtrl',["$scope",'$ionicHistory','$state',function($scope,$ionicHistory,$state){
	$scope.go = function(target){
		$ionicHistory.clearHistory();
		$state.go(target)
	}
}])
//五轴图控制器
.controller('zhouCtrl',["$scope",'$ionicHistory','$state',function($scope,$ionicHistory,$state){
	$scope.go = function(target){
		$ionicHistory.clearHistory();
		$state.go(target)
	}
}])
//效率云图控制器
.controller('stromCtrl',["$scope",'$ionicHistory','$state',function($scope,$ionicHistory,$state){
	$scope.go = function(target){
		$ionicHistory.clearHistory();
		$state.go(target)
	}
}])
