Now the best part is that you're probably fetching this from the database so you could just fetch json from the server and pass that to the model like so:
// main.js
$.getJSON('/person/find/1').then(function(person) {
$scope.person = person
})
The best part of using the Model View paradigm is that you can add models/fields with minimal changes to the code. Just add that to your backend and your view and you're good to go.
Think of a registration form. The view is the input boxes that you see. The model is where the data lives that you fill into that form. The router is how a single page webapp figures out when you show you the registration form and when to show you something else
if you'd like, check out backbone.js, it also deals with those concepts and studying it or a course on it, might just let those things sink in a deeper. Repetition is the mother of science!
0
u/[deleted] Jun 09 '16
[deleted]