Monday, 15 July 2013

javascript - Ember js download pdf nested under - which has an action -



javascript - Ember js download pdf nested under <li> which has an action -

how download pdf file on click has next syntax

<a href = "http://www.pdf995.com/samples/pdf.pdf" download >click download!</a>

and pdf associated model within <li> item this

<script type="text/x-handlebars" data-template-name="index"> <ul> {{#each item in model}} <li {{action action1}}>{{item}} <a href = "http://www.pdf995.com/samples/pdf.pdf" download >click download!</a> </li> {{/each}} </ul> </script>

where if place tag outside li works fine , pdf downloaded. how create work within <li> tag has action. seems action called first always!

demo

edit:

try this:

http://emberjs.jsbin.com/zifeyihe/7/edit

app.indexcontroller = ember.controller.extend({ actions: { action1: function(item){ alert(item.color); window.document.location.href = item.link; } } });

it redirects pdf after alert shown.

javascript pdf ember.js

No comments:

Post a Comment