私はMoodle WebServiceを使用してAngularJS Moodle Webアプリケーションを開発しました。私はMoodle eLearningのクイズを表示するためにトリンギングしています。JSON HTML文字列をHTMLに変換します
私はすべての質問を$http.
を使って得ることができます。今の問題は、私は質問を取得するときに、すべての質問は、このようなHTMLコードが付属していることである:私はこれを使用してい
Anが応答(url5)
app.controller('quizCtrl', function($rootScope, $scope, $http) {
url4 = concatUrl + 'mod_quiz_start_attempt' + '&quizid=2';
$http.get(url4).then(function (response) {
//console.log(response.data);
})
url5 = concatUrl + 'mod_quiz_get_attempt_data' + '&attemptid=7&page=0';
$http.get(url5).then(function (response) {
console.log(response.data);
$scope.questions = response.data.questions;
})
})
を取得するためにcontrolores
次のコードを使用してHTMLに質問を表示すると、HTMLコードが文字列として取得され、ng-bind-html
を使用しようとしましたが、エラーが発生しました。
{{question.html}}<br /><br />
を使用する場合、私はこれを取得してい
JSON.stringify
angular.fromJson(json);
:
<div role="main" id="main" class="ui-content scroll" ng-app="mainApp">
<div data-role="content" class="pane" id="">
<div class="page-wrap scroll" ng-controller="quizCtrl">
<div ng-repeat="question in questions | orderBy : 'question.number'" id="{{question.number}}">
<div>
<!--{{question.html}}<br /><br />-->
<p ng-bind-html="question.html"> </p><br /><br />
</div>
</div>
</div>
</div>
また、私が試しました
あなたの助けを借りてくれてありがとう!
あなたの代わりに、角度「の 'angular.js' を使用した場合。 min.js 'リンクの代わりにエラーテキストが表示されます。 :) –