angularjs - Binding data with values from a listener in angular -


i creating chome app using angular. expermineting bluetooth api has event listener being triggered when bluetooth adapter set on or off.

i showing values adapter object in html {{ powered }} {{ discovering }} , {{ available }} works fine not sure way go in angular

var myapp= angular.module('myapp', []);  myapp.controller('bluetoothcontroller', function($scope){  chrome.bluetooth.onadapterstatechanged.addlistener(   function(adapter) {     $scope.powered=adapter.powered;     $scope.discovering=adapter.discovering;     $scope.available=adapter.available;     $scope.$apply();     }); }); 

is working $scope.apply() best way this?


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -