I am confused (easily done). To me model is the data from the database sent back as JSON.

When I think of that in an Angular context, when two-way binding is configured, it makes me think the framework is watching/polling the database so that when some other user/process/etc. updates the database, the other user(s) will see the changes in x number of milliseconds. Is that right?

One way binding makes me think it is just like a regular webpage now. I fetch a page and it is updated like it always has been. I have to press a button or some other event to get it to go back to the server and update the webpage, just like I always have with regular old JavaScript and no library (though I use jQuery a lot).

Do I misunderstand these? Why would I bother with one-way binding, if I am correct? I could always do that, so is one-way binding meant to be used with a database that is updated often? Facebook uses it so it seems I am way off.

(I understand how view and model are connected to each other in Angular. I don't know if the application that uses the database with a lot of CRUD will dictate I need two-way. Timing issues, etc. aside.)

  • Related: quora.com/… – Robert Harvey Jun 14 '18 at 21:12
  • Your confusion seems to come from conflating the model and the database. They're not the same thing, and are only tangentially related if at all. – cHao Jun 14 '18 at 21:56
  • @cHao The model is what is holding the data or is a representation of it, an instance of it, or however someone wants to define it. I typically get that data and fill the model from a database. In my question, I wanted to know if the watcher was "watching" the database via Ajax for changes. – johnny Jun 15 '18 at 18:08
  • @RobertHarvey I actually found that one, but it is hard to tell if they are correct sometimes, so I thought I'd ask here. Thanks for the link. I will reread. – johnny Jun 15 '18 at 18:10
  • @johnny: That's the conflation i'm talking about. Binding concerns the view and the model. It doesn't concern the database, unless you yourself involve it. That's a whole separate thing. – cHao Jun 15 '18 at 21:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.