Within my Ember component items-map.js
, I am invoking a Google Map. The Google Map API allows me to have infoWindows (the bubbles that open once you click any pin on the map).
I have some HTML content inside these bubbles and clicking on a link within it, should transition to another route. I'm trying to achieve this using an action within the component but in order to do that I need to first be able to encode the Handlebars syntax into the HTML of the infoWindow.
The JavaScript string looks like this:
var infoWindowContent = '<a class="btn" href="javascript:void(0);" >See Items</a>';
As you can see, I have a Handlebars action within the string. While the button gets rendered, the Handlebars action does not get compiled. I tried wrapping the above string in a `Handlebars.compile()' method like this:
var infoWindowContent = Ember.Handlebars.compile('var infoWindowContent = '<a class="btn" href="javascript:void(0);" >See Items</a>';');
This produced an error. Instead of getting the button, I now see the text [object Object]
where the button is supposed to be. How can I fix this?
Aucun commentaire:
Enregistrer un commentaire