In my Component class (HeaderComponent), I want to access the changeBtnColorBg function everytime I click the two functions changeBannerArrow() and changeBannerImg()
Those functions are triggered on the onclick event in the HTML side
export class HeaderComponent implements OnInit {
imgTotal = 3;
currentImg = 0;
imgHdr = [];
changeBannerImg(imgSelect){
/* some code here */
changeBtnColorBg(this.currentImg, imgSelect);
}
changeBannerArrow(imgSelect){
from = this.currentImg;
/* some code here*/
to = this.currentImg;
changeBtnColorBg(from, to);
}
changeBtnColorBg(from, to){
this.imgHdr[from].selected = false; //change back to transparent
this.imgHdr[to].selected = true; //change bg color
}
}
But this structure produces an error of
HeaderComponent.html:15 ERROR ReferenceError: changeBtnColorBg is not defined
Can someone please help? I'm new to this