Quantcast
Channel: Is there a way to load data into script - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Is there a way to load data into script

$
0
0

So in Angular i'm trying to do

$scope.data = "<script> alert('hi'); </script>";

But unfortunately that doesn't work. I also tried to add ng-bind-html but without any results.

{{data}}

also I tried to load data in a script tag but that also seems not to work. Is there a way to avoid this all? For example

$scope.data = "bob";

-

<script>    var name = {{data}};</script>

Viewing all articles
Browse latest Browse all 3

Trending Articles