Fix $watch performance and add example to README#3
Fix $watch performance and add example to README#3dunksmith wants to merge 3 commits intobeezee:masterfrom
Conversation
|
Seems simple enough and I appreciate the PR. 2 qs- 1- What is the advantage of requiring the content be specified on an attribute? Especially in your example it seems to duplicate and create unnecessary verbosity |
|
Hi - good questions, I'll try to explain my reasoning:
So to your question - the crucial advantage is that we avoid the need for a global $watch. I'm pretty sure my code could be optimised to be more DRY by using ngBind or something, but as a first step I think it's a fair trade-off in simplicity vs performance.
There's a chance you could use a $watch expression instead on the element dimensions, and only initialize dotdotdot when they change. But in my experience (Ionic apps on Android/iOS and web) a delay of 400ms has worked well. |
An attempt to resolve two issues: