I am building a calculator in angularjs as a wordpress php plugin. Passing parameters as variables via a shortcode. I have a jquery ui-slider with min, max and step values set by passed params:
<div ui-slider="{range: 'min'}" min="{$this->weight_minimum}"
max="{$this->weight_maximum}" step="{$this->weight_increment}"
ng-model="weight">
</div>
I also added two radio buttons after the slider:
<div class="user-selection">
<label class="radio-container">{{ "Pounds" | translate }}
<input type="radio" checked="checked" name="radio"
ng-model="selection" value="lbs">
<span class="checkmark"></span>
</label>
<label class="radio-container">{{ "Kilograms" | translate }}
<input type="radio" name="radio" ng-model="selection" value="kg">
<span class="checkmark"></span>
</label>
</div>
How can I change min/max values of the slider based on radio selection? I tried using ng-if but that is for showing/hiding html. I also tried adding an if statement in the app.controller with no success.
if ($scope.selection == 'lbs') {
weight_maximum = $this->weight_maximum;
} else if ($scope.selection == 'kg') {
weight_maximum = $this->weight_maximum / 2.2;
}