| ar app = angular.module('apptui', ['ionic']) | |
| app.controller('ComputerListController', ['$scope', ComputerListController]); | |
| function ComputerListController($scope, $timeout) { | |
| $scope.computers = []; | |
| $scope.connect = function(computer) { | |
| // do something with computer, probably ID or something. | |
| }; | |
| $timeout(function() { | |
| Bonjour.browse( | |
| '_apptui-http._tcp', | |
| 'local', | |
| foundNewComputer, | |
| lostComputer | |
| ); | |
| },5000); | |
| function foundNewComputer(newComputer) { | |
| $scope.$apply(function() { | |
| $scope.computers.push(newComputer); | |
| }); | |
| } | |
| function lostComputer(computer) { | |
| console.log(computer); | |
| } | |
| } |
| <body ng-app="apptui"> | |
| <ion-side-menus> | |
| <!-- Center content --> | |
| <ion-side-menu-content> | |
| <ion-header-bar align-title="left" class=" bar-dark"> | |
| <h1 class="title">bar-dark</h1> | |
| </ion-header-bar> | |
| <ion-content> | |
| <ion-list ng-controller="ComputerListController"> | |
| <ion-item ng-click="connect(computer)" ng-repeat="computer in computers">{{computer.serviceName}}</ion-item> | |
| </ion-list> | |
| </ion-content> | |
| <ion-footer-bar align-title="left" class="bar-assertive"> | |
| <button class="button button-clear pull-right">Right</button> | |
| </ion-footer-bar> | |
| </ion-side-menu-content> | |
| <!-- Left menu --> | |
| <ion-side-menu side="left"> | |
| </ion-side-menu> | |
| <!-- Right menu --> | |
| <ion-side-menu side="right"> | |
| </ion-side-menu> | |
| </ion-side-menus> | |
| </body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment