Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4838

Referencing model data from within a function

$
0
0

@Gen wrote:

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);

})

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4838

Trending Articles