Skip to content

Instantly share code, notes, and snippets.

@vistajess
Created April 6, 2017 14:19
Show Gist options
  • Save vistajess/31084cf2fd68cc30cb6508b5c1598d69 to your computer and use it in GitHub Desktop.
Save vistajess/31084cf2fd68cc30cb6508b5c1598d69 to your computer and use it in GitHub Desktop.
//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