<script>
function fun1($scope, $http){
$scope.options="options"
$scope.option1="option1"
$scope.onChangeHandler=function(arg1){
$http({
method: 'GET',
url: "/someurl"
}).then(function successCallBack(responsedata){
$scope.response = responsedata.data
},function errorCallBack(response){
alert("Error!");
});
}
var myApp = angular.module("myApp", [ngSanitize]);
myApp.controller("fun1", fun1);
myApp.config(function($interpolateProvider){
$interpolateProvider.startSymbol("[[")
$interpolateProvider.endSymbol("]]")
});
}
</script>
<body ng-app="myApp" ng-controller="fun1">
<div>
<select class=target id="option" ng-model="options", ng-change="onChangeHandler(options);">
<option ng-model="option1">Option1</option>
</select>
<div id=result ng-bind-html="response"></div>
</div>
</body>
<script>
function fun1($scope, $http){
$scope.data=[{name: 'name1', age: 20}, {name: 'name2', age: 25}];
}
var myApp = angular.module("myApp", []);
myApp.controller("fun1", fun1);
myApp.config(function($interpolateProvider){
$interpolateProvider.startSymbol("[[")
$interpolateProvider.endSymbol("]]")
});
</script>
<body ng-app="myApp">
<div ng-controller="fun1">
<table>
<thead>
<tr>
<th>Name</th>
<th>Age</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="usr in data">
<td>[[usr.name]]</td>
<td>[[usr.age]]</td>
</tr>
</tbody>
</table>
</div>
</body>
4.Response成功返回,但在目标div中呈现为普通测试。这包括甚至[[**]]角度的表达如下: -
return render(request, someurl.html)
Name Age
[[usr.name]] [[usr.age]]
。Q1。为什么角度不起作用? chrome dev控制台上没有错误,但表中的实际值未填充。我错过了什么概念? Q2。还有哪些其他选项可以呈现类似于ng-bind-html的角度响应。
conflict
JAVASCRIPT代码
{% verbatim %}
<div ng-app="myApp" ng-controller="myCtrl">
<p>Username is {{ Data.username }}</p>
</div>
{% endverbatim %}