vendredi 9 janvier 2015

How to change model value in emberjs using jquery?

How can I change a model value in emberjs using jquery?


for example, if I have this:



App.LIENS=[
{
id: 1,
apn: 'apn1',
fips: '01700',
state: 'CA',
county: 'Los Angeles',
address: 'somewhere st123',
debt: 4000,
isInPortfolio: false
},
{
id: 2,
apn: 'apn2',
fips: '01744',
state: 'FL',
county: 'Miami',
address: 'someplace st700',
debt: 2000,
isInPortfolio: true
},
{
id: 3,
apn: 'apn3',
fips: '05690',
state: 'FL',
county: 'Orlando',
address: 'ExactPlace in st111',
debt: 2500,
isInPortfolio: false
}
];

App.Liens = DS.Model.extend({
id: DS.attr('number'),
apn: DS.attr('string'),
fips: DS.attr('string'),
state: DS.attr('string'),
county: DS.attr('string'),
address: DS.attr('string'),
debt: DS.attr('number'),
inPortfolio: DS.attr('boolean')
});


How would I change the isInPortfolio value when a button is pressed using jquery?


This is my failed attempt:



$(document).ready(function(){
var addLienButton=$('#addLien');
addLienButton.click(function(){
App.LIENS('isOnPortfolio',true);
});
});


Im learning ember.js so if there is a better way of doing this please let me know (even though I would like to know how to achieve this using jquery also). Thanks in advance!





Aucun commentaire:

Enregistrer un commentaire