How can I pass a variable defined in a controller to a popover defined in the corresponding template? So, I have a pretty standard bootstrap popover defined in my project like so:
li tag that triggers the popover
<li data-container="body" data-toggle="popover" data-placement="left" data-popover-content="#earnings">
<div><img {{bind-attr src="this.photo"}}></div>
</li>
#earnings div for data-popover-content
<div id="earnings" class="hidden">
{{#each controller_variable}}
//code
{{else}}
//code
{{/each}}
</div>
controller_variable
controller_variable: function(){
var information; //pseudo-code
return information;
}.property()
javascript to handle popover
<script type="text/javascript">
$(function(){
$("[data-toggle=popover]").popover({
html : true,
content: function() {
var content = $(this).attr("data-popover-content");
return $(content).html();
}
});
});
</script>
The controller_variable
contains 5 objects in an array, but the {{else}}
block is being displayed meaning there is nothing in controller_variable
.
I feel like it has something to do with the fact that the popover content is hidden, but is there a standard way of what I'm trying to do? Let me know if something's not clear.