r/javascript • • Nov 05 '14

AngularJS: The bad parts

http://larseidnes.com/2014/11/05/angularjs-the-bad-parts/
87 Upvotes

88 comments sorted by

View all comments

Show parent comments

12

u/Poop_is_Food Nov 06 '14

It's not hard to build something after a couple hours. It gets hard when you need to do things out of the ordinary, such as keeping track of the actual DOM updates that angular is doing.

2

u/Cintax Nov 06 '14

Out of curiosity, why would you ever need to do that? Doesn't that village the core premise of MV*?

10

u/Poop_is_Food Nov 06 '14 edited Nov 06 '14

Well let's say you have a modal, and the positioning of the modal depends on its height. If it's taller than the viewport then you position it 100 px from the top of the window and then scroll. If it's shorter than the viewport the you center it vertically. You need to measure the height of the modal. And you can't measure it until it's actually in the DOM. And if angular is in charge of appending it and populating its content, then it's very hard to tell when that process is complete.

edit: why downvotes?

2

u/ganarajpr Nov 06 '14

This problem has nothing to do with Angular and has everything to do with thinking in terms of views than models. Also, thinking in terms of individual elements than thinking in terms of selectors - which is how you would have solved it before angular.

I wont provide you a solution to this problem here. But know that there IS a solution. You just have to think about it without considering a css selector.

1

u/Poop_is_Food Nov 06 '14 edited Nov 06 '14

Did you respond to the wrong comment? Not sure what selectors and models have to do with this. I said "modal" not "model."

And yes I know there is a solution. I've found the solution and it was a pain in the ass which is why I used it as an example.