javascript - How to access element's current style from directive in Angular? -


suppose have following code:

<div style="transform: translatex(100px);" applytranslatezdirective><div/> 

the directive required append translatez(...) value transform property instead of overwriting it.

the end result should like: transform: translatex(100px) translatez(...).

problem

the code below not work, because el's styles not yet initialized when ngoninit() called.

/////////////// // directive // ///////////////  private initialtransform: string;      constructor(private el: elementref) { }      ngoninit() {     this.initialtransform = this.el.nativeelement.style.transform; } 

what other ways access element's initial style?

p.s

please keep in mind, access other lifecycle hooks limited, because dealing directives.


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -