This is a migrated thread and some comments may be shown as answers.

Using jquery to add to model

1 Answer 49 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 27 Sep 2013, 07:01 PM
Not sure this is the right forum for this but here goes. I have a mobile app that gets an image via the camera. It puts the contents of the image into the variable 'imageData' I then use jquery:
$('#smallImage').attr('src', "data:image/jpeg;base64," + imageData);
into the image:
<img id="smallImage" width="100%" data-bind="attr: { src: Robot.Picture }">
that works fine as far as display goes. It does not however add it to "Robot"

I am using jaydata to save the data to a local database and the model has a lot of fields (all text inputs) and they all data-bind fine. 

Any ideas?

1 Answer, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 27 Sep 2013, 07:26 PM
It never fails, I post a question then almost immediately I figure it out. I had to push the variable into the model via:
viewModel.Robot.set('Picture', imageData);
Added that right before the sync and all was right in my world. Hopefully this might helps someone else.
Tags
MVVM
Asked by
Richard
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Share this question
or