5 ms·
What is the trick? I usually use "!!variable" to ensure boolean conversion so I guess I would have been fine?
by Guillaume86 12y ago
What is the trick? I usually use "!!variable" to ensure boolean conversion so I guess I would have been fine?
- nawitus 12y agoYeah, "!!variable" works, and in my case I used ".length > 0". Boolean(variable) works too. It's just unfortunate when you're assuming that the expression or typecasting works like in JavaScript, and then AngularJS had to invent these unnecessary rules that make no sense. JavaScript's type coercion is tricky enough, you don't need to make it worse.