darylrowland / angucomplete

AngularJS Autocomplete Directive
510 stars 281 forks source link

Eval? #3

Open davidchase opened 10 years ago

davidchase commented 10 years ago

I found your autocomplete via ngModules its pretty sweet! & easy to use..

But my question is, what was the reasoning behind using eval when you can just use bracket notation instead and achieve the same results instead of sprinkling eval around?

Thanks -David

toutpt commented 10 years ago

+1 you should not use eval.

stevenharman commented 10 years ago

From what I can tell, the eval allows arbitrarily long chains of "dot notation". If we had list comprehensions, or by brute-forcing a for loop, the same thing could be achieved by split('.')-ing and then using bracket notation.

darylrowland commented 10 years ago

Yeah I agree, had meant to remove the eval but completely forgot it was still in there. Will fix it tomorrow. Cheers guys.

Daryl.

Sent from my iPhone

On 4 Feb 2014, at 21:32, Steven Harman notifications@github.com wrote:

From what I can tell, the eval allows arbitrarily long chains of "dot notation". If we had list comprehensions, or by brute-forcing a for loop the same thing could be achieved by split('.')-ing and then using bracket notation.

— Reply to this email directly or view it on GitHub.

davidchase commented 10 years ago

Yeah I was just curious because in my implementation I subbed out the eval with bracket notation and all is well :)