在http成功的回调函数里面
var ue = UE.getEditor('answer');
$http.get("question_get", {params: post}).then(
function (response) {
console.log(response);
$scope.list = response.data.result;
$("#picture").show();
UE.getEditor('answer').setContent($scope.list.answer);
});
直接对ueditor赋值,发现有时候程序报错,而且几率很大,经查找,原因为调用setContent的时候ueditor还未成功初始化
UE.getEditor('answer').setContent($scope.list.answer);
这行代码修改为:
ue.addListener("ready", function () {
UE.getEditor('answer').setContent($scope.list.answer);
});
测试后,再没有没发现这样的问题