I have a simple application that allows a user to pick a shingle at the beginning. They are then presented with the option to upgrade that shingle. On the upgrade page the shingle image should update as an upgraded shingle is selected.
On the upgrade page they are shown their current shingle in an image.
<img style="width:15em; height:15em;"
src="../../assets/shingles/{{upgradeShingle}}.jpg" />
I have a slider with the available upgrades.
<p-slider class="col-sm-1" [(ngModel)]="upgradeShingle" (onChange)="handleChangeShingle($event)" [min]="val2" [max]="13" [step]="1" orientation="vertical" [style]="{'height':'30em'}"></p-slider>
Here is the onChange event code:
handleChangeShingle(e) {
this.upgradeShingle = e.value;
console.log(this.upgradeShingle);
if (this.upgradeShingle = this.currentShingle.shingleID) {
this.shingleChanged = false;
}else{ this.shingleChanged = true; }
}
As you can see, the src tag has an interpolation of the Angular variable called upgradeShingle and the slider has a binding to the same variable. On the page initialization it works great. However, if I move the slider and the onChange event is triggered, it updates the bound variable but the image does not update accordingly. What am I missing?