I'm trying to retrieve data from Firebase to range sliders, so that if I refresh the page, the value of the range slider represents the same value that it was set to before refreshing. In other words, the range slider must show the value saved in database.
HTML
<div class="card padding" ng-app="starter" ng-controller="valueCtrl">
<h4>Colony strenght: {{value}}</h4>
<div class="range range-dark">
<i class="icon ion-sad icon assertive"></i>
<input type="range" name="volume" min="1" max="5" value="" ng-model="value">
<i class="icon ion-happy icon balanced"></i>
</div>
</div>
angular:
angular.module('starter', ['ionic', 'firebase'])
.controller('valueCtrl', function ($scope, $firebase) {
var rootRef = new Firebase('https://amber-torch-9773.firebaseio.com/');
var childRef = rootRef.child('neki');
$scope.$watch('value', function (newVal) {
childRef.update({
colony_strenght: newVal
});
});
});
Thank you for your answer!