| var app = angular.module('apptui', ['ionic']) | |
| app.controller('ComputerListController', ['$scope', ComputerListController); | |
| function ComputerListController($scope) { | |
| $scope.computers = []; | |
| $scope.debug = "im here bro"; | |
| Bonjour.browse( | |
| '_apptui-http._tcp', | |
| 'local', | |
| foundNewComputer, | |
| lostComputer | |
| ); | |
| $scope.$on('computerEvent', function(result) { | |
| if (result.action == 'added') { | |
| $scope.computers.push(result.computer); | |
| } | |
| // etc | |
| }); | |
| function foundNewComputer(newComputer) { | |
| // foundNewComputer can be any name. | |
| $scope.$emit('computerEvent', { | |
| action: 'added', | |
| computer: newComputer | |
| }); | |
| } | |
| function lostComputer(computer) { | |
| $scope.$emit('computerEvent', { | |
| action: 'lost', | |
| computer: newComputer | |
| }); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment