tobbbe
7/4/2014 - 6:53 AM

angular one time watcher

angular one time watcher

//wait for things to be loaded
var watcher = $scope.$watch(function () {
     return thingsService.getModel();
   },                       
    function(newdata) {
    	if (newdata.machines != null) {
    		$scope.things = newdata.things;
    		
    		// destroy the watcher
    		watcher();
    	};
  }, true);