Im making a embedable widget and i need to generate a unique JavaScript snippet for the user to copy past into there site. For simplicity i killed most of the code.
widget-generator.js
.directive('widgetGenerate',function() {
return {
restrict: 'AE',
replace: true,
templateUrl: 'embed.html', // file i need to generate
scope: {
"height": "@"
}
};
});
embed.html
<a height='{{height}}'> // WORKS!
</a>
<script type="text/javascript">
var something = {{height}}; // DOES NOT WORK!!!!!!!!!!!!!!!!!!!!!!
</script>
On page for user to copy past:
<textarea>
<widget-generate height = '300'/>
</textarea>
Desired text output:
<a height='300'> </a>
<script type="text/javascript">
var something = 300;
</script>
Problem is i cannot generate the JavaScript section like this. How can i do this in angularjs?