I’m extremely new to ember CLI(and javascript for that matter), so I’m not sure I’m doing this the ember way, or even anywhere close to correct, but I have the following function in templates/components/sig.hbs. If I type in a value for patdata, everything works perfectly, but with a value of {{pat}} I get an “unexpected end of input” error. How can I go about accomplishing this? I’ve reviewed the ember guide on passing a property to a component, and I can’t quite get it. Any advice would be much appreciated!
var doc = html2pdf().from(element).set(opt).output('blob').then(function (blob){
var patdata = {{pat}}
alert (patdata)
var data = new FormData();
data.append('data' , blob);
data.append('data', patdata);
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (this.readyState == 4) {
if (this.status !== 200) {}
}
}
xhr.open('POST', 'http://localhost:8080/pdf', true);
xhr.send(data);
})
edit:
After a lot of time on Google, I came upon the following recommendation:
var obj = Ember.Object.create(this.get('store')),
hash = obj.getProperties('pat');
patdata = JSON.stringify(hash);
alert(patdata)
Unfortunately, this just returns {}