我有一个幻灯片进/出面板.除了之外,一切都对我很好Logout
.请查看侧面板视图.
Angular Social
Dashboard Friends Settings Search Logout
以下是我的控制器代码
(function () { 'use strict'; angular.module('starter').controller('DashboardController', DashboardController); DashboardController.$inject = ['UserService', '$scope', '$state', 'CommonService' ,'$ionicLoading']; function DashboardController(UserService, $scope, $state, CommonService, $ionicLoading) { var ac = this; ac.logout = logout; initController(); function logout() { console.log('reachedhere'); CommonService.logout() } function initController() { var loggedInStatus = localStorage.getItem('userLoggedIn'); if (loggedInStatus === 'false') { $state.go('signin'); } loadCurrentUser(); loadnotifications(); } function loadCurrentUser() { var name = { 'username' : localStorage.getItem('username') }; UserService.GetByUsername(name).then(function (response) { $scope.userData = response; }); } function loadnotifications() { $ionicLoading.show({ template: 'loading' }); var name = { 'username' : localStorage.getItem('username') }; UserService.GetByUsername(name).then(function (data) { var id = data.id; console.log(data.id); UserService.GetFriedRequests(id).then(function (response) { $scope.requests = response; }); }); $ionicLoading.hide(); } } })();
当我点击时Logout
,侧面板关闭,控制器没有任何反应.