Open shadowofsoul opened 11 years ago
append() and partial() are the same methods. partial() is just an alias to append(), you should only need to use one or the other not both.
try:
var Plates = require('plates');
var map = Plates.Map();
var html = '<div class="formPayment"></div>';
map.class('formPayment').partial('<input type="hidden" name="token" value="EC-5EK42155LE6337258" />');
//map.class('formPayment').append('<input type="hidden" name="token" value="EC-5EK42155LE6337258" />');
var output = Plates.bind(html, {}, map);
console.log(output);
outputs:
<div class="formPayment"><input type="hidden" name="token" value="EC-5EK42155LE6337258" /></div>
If you just want to use the id to bind you can rely on the implicit mapping see:
var Plates = require('plates');
var html = '<div id="test">Old Value</div>';
var data = { "test": "New Value" };
var output = Plates.bind(html, data);
from the readme file. Or if you require an explicit mapping try:
var Plates = require('plates');
var map = Plates.Map();
var html = '<div id="test">Old Value</div>';
var data = { "foo": "New Value" };
map.where('id').is('test').use('foo');
var output = Plates.bind(html, data, map);
console.log(output);
hope this helps
I don't know if i'm doing it wrong or is a bug, but when i try to append a simple :
i get:
there is any way i can fix this? also, there is a way to use an id and not a class to refer the object where the html should be added?
Regards