Angularjs summernote: $scope.editor.insertImage 不是函数
Angularjs summernote: $scope.editor.insertImage is not a function
我想上传一张图片到服务器并将其作为图片放在我的文本中。
编辑:
<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
有谁知道我做错了什么吗?
更改代码
$scope.editor.insertImage($scope.editable, result.data.url);
至
$scope.editor.summernote('insertImage', result.data.url, 'filename');
它适用于 summernote 0.7.0 和 angular-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
有谁知道我做错了什么吗?
更改代码
$scope.editor.insertImage($scope.editable, result.data.url);
至
$scope.editor.summernote('insertImage', result.data.url, 'filename');
它适用于 summernote 0.7.0 和 angular-summernote