Created
April 6, 2017 14:19
-
-
Save vistajess/31084cf2fd68cc30cb6508b5c1598d69 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//UI Component | |
<topbar-menu is-valet-online="$ctrl.isValetOnline" change-status-func="$ctrl.toggleVisibilityStatus()"></topbar-menu> | |
// JS Code | |
'use strict'; | |
class ValetDashboardController { | |
/*@ngInject*/ | |
constructor($q, $scope, $cookies , Pusher) { | |
this.isValetOnline = false; | |
this.Pusher = Pusher; | |
this.toggleVisibilityStatus = this.toggleVisibilityStatus.bind(this) | |
} | |
// ========================== UI RELATED ================== | |
PusherListenIncomingAndCancelling() { | |
//.... | |
} | |
toggleVisibilityStatus() { | |
this.isValetOnline = !this.isValetOnline; | |
this.checkVisibility(this.isValetOnline) | |
} | |
checkVisibility(bool) { | |
bool ? this.PusherListenIncomingAndCancelling() : this.Pusher.unsubscribe(`valet-station-${this.valetDetails.garages_id}`); | |
} | |
} | |
ValetDashboardController.$inject = [ | |
'$q', | |
'$scope', | |
'$cookies', | |
'Pusher', | |
]; | |
export default ValetDashboardController; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment