How to programtically access built-in view property


#1

There’s isActive property for ion-icon, I’d like to change it in ts code, here’s what I tried

# in template
<ion-icon #myIcon name="home"></ion-icon>

# in component 
@ViewChild("myIcon") myIcon;
...

onClick() {
  myIcon.isActive = true;
}

however it doesn’t work. I know I can bind a variable to isActive property, but I still want to know how to change view property in ts code.


#2

I’m confused. You understand that all you have to do is to bind to isActive, and therefore you can solve your problem by simply changing whatever property that is bound to, but that’s not good enough and you’re futzing around with @ViewChild?


#3

I was wondering if I can directly update view property


#4

And I am wondering why modifying the bound backing property is insufficient.