[SOLVED] Range max bound to controller variable


#1

I am trying to create a range slider for selecting a quantity to sell. I want the maximum value to be set based on a member variable defined in my component’s Typescript file. Here is the code I’m using now:

<ion-range min="1" max=(maxSellable) pin="true" snaps="true" [(ngModel)]="quantity">
<ion-label range-left>1</ion-label>
<ion-label range-right>{{maxSellable}}</ion-label>
</ion-range>
</ion-item>```

The desired behavior is that the user will be able to select a value in the range of 1 to maxSellable, in integer steps. The actual output is a range slider with proper labels of 1 and maxSellable but with selectable values of 1-100. 

Am I doing something wrong with `max=(maxsellable)`? It is defined as a `number` in Typescript and I have tried using it irectly as well as calling toString() and then parseInt().

Any help would be appreciated.

Edit: formatting

#2

[max]="maxSellable"


#3

That worked, thanks a lot.