RadMie / ng-knob

Angular.js directive to Knob component powered by d3.js (without jQuery)
http://radmie.github.io/ng-knob
MIT License
117 stars 48 forks source link

color of the knob cannot be updated after server data request #10

Closed sabbir-hossain closed 8 years ago

sabbir-hossain commented 8 years ago

After returning data from server request, the color of the knob cannot be updated as like as given image link http://screencast.com/t/Ueeonnx4 . My code is given below:

JavaScript Code

$scope.options = { /* knob option */   };

$http
   .get(url)
   .then(function(res) {
      $scope.details = res.data.rating   
   }, function(err) {});

html code

<ui-knob value="details" options="options "></ui-knob>
yuniers commented 8 years ago

I'm try it too and want do a countdown like a watch but colour is not changing.

sabbir-hossain commented 8 years ago

I solve this problem by using the following code :

angular.module('', [])
     .controller('DemoCtrl', function($scope, $timeout) {
         $scope.options = { /* knob option */   };
         $scope.details = 0;
          $http
               .get(url)
               .then(function(res) {
                    $timeout(function() {
                        $scope.details = res.data.rating   
                    }, 1000);                             
           }, function(err) {});
     });
mbostwick commented 8 years ago

Created pull request to fix this..