3 ms·
It's better because you get nice stuff like two way binding which your js won't give you. Also, building templates in html is definitely nicer and more expressi
by aidos 13y ago
It's better because you get nice stuff like two way binding which your js won't give you. Also, building templates in html is definitely nicer and more expressive than doing it in js. That specific example doesn't look great - but it's probably not the best way of doing it either.
On the performance - it's going to be slower than doing everything in specifically optimised code, but it's almost certainly not going to be a problem. My project has a million+ objects in js once the interface loads and I have watches on a big chunk of that data and the interface is still snappy. Granted, there are bits where I have to be careful to make it snappy, but that's life. Development time is so much faster I wouldn't make the tradeoff for the world now.
- steveklabnik 13y ago> two way binding Other frameworks also provide two way binding. > better than in JS Handlebars is much more like 'programming _with_ HTML' than 'programming in JS'
- ulisesrmzroche 13y agoHe didn't mention other frameworks - but how JS doesn't give you two-way bindings. Which it doesn't. Your second point is about Handlebars, which isn't even mentioned in the comment you replied to.
- steveklabnik 13y agoMy parent suggests two way binding requires manually annotating the DOM, implying that it's an Angular-exclusive feature. Furthermore, those who don't like annotation aren't writing JavaScript views, they're writing HTML templates and annotating them with some JS, which means the parent offers a false dichotomy.
- ulisesrmzroche 13y agoNo, that wasn't implied. He's just saying that's what it's there for in this example.
- steveklabnik 13y agoI guess we just read it differently, then.
- ulisesrmzroche 13y agoWe did, and he just corrected you, so there's that.
- steveklabnik 13y agoPLONK
- aidos 13y agoIncorrect. I was saying that the joke example presented didn't in anyway show the difference in power that Angular gives you over raw js - nothing at all about Angular exclusivity.
- steveklabnik 13y agoWord. I think we can all agree that EVERY framework is far better than plain old JS; the comparison is so nonsensical to me that I assumed you couldn't possibly be making it. Seems good!