I’m currently trying to learn ractive js
at the moment. Right now I’m figuring how I can store a dynamic value and pass it on a JSON object
and set it to the API.
I have managed to get the value using app.get
but how I do store it or pass it to a specific key-pair or object. Right now I’m getting an unexpected identifier as an error.
WIP: http://fiddle.jshell.net/clestcruz/6L1vwcqw/
<div class="form-element-container">
<label>Company Name <span class="required">*</span></label>
<input type="text" class="form-text full-width" placeholder="Enter the company name" id="accountName" value="{{leadData.accountName}}"/>
</div>
<div class="col col2">
<label>Street Name.</label>
<input type="text" class="form-text" placeholder="-" id="streetName" value="{{leadData.streetName}}"/>
</div>
<div class="form-element-container default-cta-container">
<a class="button cta" on-click="addLead">Create Account</a>
</div>
app.on('addLead', function(event) {
var leadData = {},
var data = ractive.get('leadData');
app.set(function(data, data) {
var leadData = {
"accountName": data.accountName,
"streetName" : data.streetName,
}
});
});