News for hackers. Stuff that matters.
Re:AngularJS versus Ember by SolarUpNote on Sunday June 16, 2013 @04:35PM (#5889838)
What you're saying is interesting - I just want to make sure I'm understanding correctly.

So, the app functions on its own in the client, and only checks-in periodically with the server to see if anything is not valid?

(As opposed to sending a request to the server for every change.)

So for example: when I submit a comment, it doesn't go to the server right away. It immediately displays successfully in my browser, and could be submitted to the server 2 seconds from now, or something?

Re:AngularJS versus Ember by EvilTrout on Sunday June 16, 2013 @04:45PM (#5889895)
It's not as periodic as that.

Ajax by definition is asynchronous. When you submit a post, the Ajax request is fired right away. But we don't wait for a response before showing the post in the stream (success case). We show it right away.

Then WHEN we receive a reply, we check the error status and if it was success, do nothing. If it failed, we revert the UI to the previous state. This is really easy with a client side MVC framework.

The downside is the failure case can be disorienting, as something will appear and then disappear. But the vast majority of requests, say, 99% never fail so the user so we optimize for that case.