Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49083

Ion-range NgModel not updating

$
0
0

My ion-range component is not working because ngModel is not updating when changed. I printed on the logs the value of the ngmodel and I saw that it never changes. Is the page in question a modal?

MyPage .html:
<ion-content class="ion-padding">
  <ion-row class="ion-margin-bottom">
    <ion-col size="7">
      <ion-label>Apparent Size</ion-label>
    </ion-col>
    <ion-col size="5" class="ion-text-end">
      <ion-label>from {{this.apparentSizeTotalRange.lower}}' to
        {{this.apparentSizeTotalRange.upper}}'
      </ion-label>
    </ion-col>
  </ion-row>
  <ion-row class="ion-margin-bottom">
    <ion-col size="">
      <ion-range class="dual-range" dual-knobs snaps="false" step="10" pin="false"
         [min]="20" max]="100" [(ngModel)]="this.apparentSizeTotalRange"></ion-range>
    </ion-col>
  </ion-row>
</ion-content>
MyPage .ts:
import { Component, OnInit, Input } from '@angular/core';
import { ModalController} from '@ionic/angular';

@Component({
  selector: 'app-filter',
  templateUrl: './filter.page.html',
  styleUrls: ['./filter.page.scss'],
})

export class FilterPage implements OnInit {

  apparentSizeTotalRange: any = { lower: 0, upper: 0 };

constructor(private modalController: ModalController) {  }

ngOnInit() {
    this.initFilters();
  }

initFilters() {
    this.apparentSizeTotalRange = {lower: 20, upper: 100};
  }
}

I also tried to set the range values as follows without getting results:

this.apparentSizeTotalRange.lower = 10;
this.apparentSizeTotalRange.upper = 100;

Can anyone help me?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 49083

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>