I'm having trouble finding the entry in this render.onload Function below I know that the answer may include closing, but I can not wrap my brain around it so far.
var PhotoModel = backbone.model.extend ({initialize: function () {this.uploadPhoto ();}, uploadfoto: function () {var file = this.get ("file" ); Var reader = new file reader (); reader.readAdata url (file); reader.onload = event {// I do not have access to "this" here ... this.dataURL = event.target. Result;}}}); Create a reference outside the scope of
this like this Do the job:
var self = this; // or var = this; Reader.onload = function () {// `` self 'self.model.dataURL =' use.target.result '`log in it; }
No comments:
Post a Comment