我想打印一个" Hello World"将HTML行转换为Angularjs。那可能吗? 请帮助!
答案 0 :(得分:0)
其中一种方式
<div ng-controller="myController">
<p>{{ message }}</p>
<div class="container"></div>
</div>
<script>
app.controller('myController', ['$scope', function($scope) {
//angular variable to print
$scope.message = "Hello World";
//regular javascript
var div = document.getElementsByClassName("container");
div[0].innerHTML = $scope.message;
//jQuery
$(".container").html($scope.message);
}]);
</script>