javascript - Limit backbone Model attributes that server sends to page? -


i have been reading on backbone.sync , backbone parse. admit confused. have bb model inheriting model , sending attributes page. want limit attributes sends page, right sending database table (only want id, fname, lname, etc). model wont used save, reference within page. question override backbone.sync or parse , do on inheriting model or "super" model?

initial call:

tss.principal = new tss.models.user(@html.raw(this.user.tojson())); 

inheriting model principal use:

tss.models.user = _.extend(tss.models.user, { parse: function (response, options) {     this.set("roles", new tss.collections.roles(response.roles));     response.roles = null;      return tss.models.user.parse.call(this, response, options); } }); 

actual "super" model:

tss.models.user = backbone.model.extend({     idattribute: "id",     urlroot: tss.paths.data + '/usersapi' }); 

you should doing serverside (in user.tojson() function) , prevent data ever being sent down clientside javascript code.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

IIS->Tomcat Redirect: multiple worker with default -