ceri-comps / ceri-icon

webpack based - load only what you need - svg inline icons
30 stars 2 forks source link

Change icon from JS #4

Open andreyrd opened 7 years ago

andreyrd commented 7 years ago

I'd like to be able to change the icon from JavaScript like so:

el.name = 'fa-chevron-up';

Simply setting the property doesn't change the icon, and I can't find any way to force it re-render or something.

paulpflug commented 7 years ago

hey, it should work now. I had something wrong deep inside change detection. Had to rewrite it 2 times ..

both el.name = "fa-chevron-up" and el.setAttribute("name","fa-chevron-up") should work