Angularjs summernote:$ scope.editor.insertImage不是函数

时间:2015-12-17 19:18:22

标签: javascript angularjs image summernote

我想将图像上传到服务器并将其作为图像放在我的文本中。

编辑:

<summernote ng-model="answer.value" id="answerValue" config="options" on-image-upload="imageUpload(files)" editable="editable" editor="editor"></summernote>

JS代码:

$scope.options = {
   height: 400
};
$scope.imageUpload = function(files) {
    answer.uploadImage(files[0]).then(function(result) {
        console.log('image upload\'s editor:', $scope.editor);
        console.log('image upload\'s editable:', $scope.editable);
        $scope.editor.insertImage($scope.editable, result.data.url);
    }, function(result) {

    });
};

库:

<script src="bower_components/jquery/dist/jquery.min.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="bower_components/summernote/dist/summernote.min.js"></script>
<script src="bower_components/angular/angular.min.js"></script>
<script src="bower_components/angular-summernote/dist/angular-summernote.min.js"></script>
定义了 $ scope.editor和$ scope.editable,但它说:

$scope.editor.insertImage is not a function

有谁知道我做错了什么?

0 个答案:

没有答案