angular - Changing styles/css in Angular2 with JS changes styles for a moment and then reverts back to its previous styles -


so i'm using following js change styles elements in angular 2. when load view height set moment maxheight = 100, after few millisecs reverts styles on stylesheets. has clues might happening can styles changed directly js in angular?

  let projectmatchers = document.getelementsbyclassname("th-project-matcher");         let rowmatchers = document.getelementsbyclassname("th-row-matcher");          let maxheight = 100;         rowmatchers[i].style.height = maxheight + "px";         projectmatchers[i].style.height = maxheight + "px"; 

ok think styles applying javscript overwritten change events of angular 2, used ngstyle apply styles directly div , works without problems:

    <div class="my-class" [ngstyle]="matchheight(i)"></div> 

this matchheight():

public matchheight(index: number): string {     return {         height: "250px",     }; } 

Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -