(function (app) {
    app.controller('homeCtrl', ["$scope", "$state", "msg", "$ionicPopover"
        , function ($scope, $state, msg, $ionicPopover) {
            $scope.type = 1;//tab切换
            $scope.changetype = function (type) {
                $scope.type = type;
            }
          
           
            $ionicPopover.fromTemplateUrl('my-popover.html', {
                scope: $scope
            }).then(function (popover) {
                $scope.popover = popover;
            });
            $scope.openPopover = function ($event) {
                $scope.popover.show($event);
            };
            $scope.closePopover = function () {
                $scope.popover.hide();
            };
        $scope.$on('$ionicView.beforeEnter', function () {

        });
        $scope.todetail = function () {
            $state.go('app.home_userdetail');
        }
        }]);
    app.controller('userDetailCtrl', ["$scope", "$state", "msg", "$ionicTabsDelegate"
        , function ($scope, $state, msg, $ionicTabsDelegate) {
            $scope.type = 1;//tab切换
            $scope.tosupport = false;
            $scope.support = function ($event) {
                $event.stopPropagation();
                $scope.tosupport = true;
            }
            $scope.cancelsupport = function () {
                $scope.tosupport = false;
            }
            $scope.changetype = function (type) {
                $scope.type = type;
            }
            $scope.index = 0;
            $scope.changeindex = function (index) {
                $scope.index = index;
            }
            $scope.$on('$ionicView.beforeEnter', function () {
                $ionicTabsDelegate.showBar(false);
            });
            $scope.$on('$ionicView.leave', function () {
                $ionicTabsDelegate.showBar(true);
            });
        }]);
    app.controller('searchCtrl', ["$scope", "$state", "msg", "$ionicTabsDelegate", "$ionicNavBarDelegate"
        , function ($scope, $state, msg, $ionicTabsDelegate, $ionicNavBarDelegate) {
            $scope.index = 0;
            $scope.index1 = 0;
            $scope.vm = {
                keywords : ""
            }
            $scope.ismore = true;
            $scope.selectHot = function (index) {
                $scope.index = index;
            }
            $scope.selectHistory = function (index) {
                $scope.index1 = index;
            }
            $scope.showmore = function () {
                $scope.ismore = true;
            }
            $scope.keychange = function () {
                $scope.ismore = false;
            }
            $scope.type = 1;
            $scope.changetype = function (type) {
                $scope.type = type;
            }
            $scope.$on('$ionicView.beforeEnter', function () {
                $ionicTabsDelegate.showBar(false);
                $ionicNavBarDelegate.showBackButton(false);
            });
            $scope.$on('$ionicView.leave', function () {
                $ionicTabsDelegate.showBar(true);
            });
        }]);
   
    
})(angular.module('app.controllers'));