这就是我完成编码的方式。
请为此,需要别人的帮助。
下面是HTML和Javascript代码
<html>
[<head>][2]
<script type="text/javascript" src="//cdn.tinymce.com/4/tinymce.min.js">
</script>
<script type="text/javascript"
src='https://cdnjs.cloudflare.com/ajax/libs/angular-ui-
tinymce/0.0.19/tinymce.js'></script>
<!-- AngularUI TinyMCE -->
</head>
<body ng-app="myApp" ng-controller="myController">
<form>
<textarea ui-tinymce="tinymceOptions" class = "text1" id="mytextarea"
>Hello, World!</textarea>
</form>
</body>
</html>
JavaScript文件:
var myAppModule = angular.module('myApp', ['ui.tinymce']);
myAppModule.controller('myController', function($scope) {
tinyMCE.init({
selector: "text1"
})
$scope.tinymceOptions = {
plugins: 'link image code',
toolbar: 'undo redo | bold italic | alignleft aligncenter alignright |
code'
};
})
这是我运行代码后得到的
答案 0 :(得分:0)
请考虑以下代码,该代码应该有效:
var myAppModule = angular.module('myApp', ['ui.tinymce']);
myAppModule.controller('myController', function ($scope) {
tinyMCE.init({
selector: "text1"
})
$scope.tinymceOptions = {
plugins: 'link image code',
toolbar: 'undo redo | bold italic | alignleft aligncenter alignright | code '
};
$scope.model= "text";
})
<html>
<head>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.8/angular.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.9.5/tinymce.min.js"></script>
<script type="text/javascript" src='https://cdnjs.cloudflare.com/ajax/libs/angular-ui-tinymce/0.0.19/tinymce.js'></script>
<!-- AngularUI TinyMCE -->
<script type="text/javascript" src="index.js"></script>
</head>
<body ng-app="myApp" ng-controller="myController">
<form>
<textarea ui-tinymce="tinymceOptions" class="text1" id="mytextarea" ng-model="model">Hello, World!</textarea>
</form>
</body>
</html>
与您的代码相比,变化:
$scope.model= "text";
p.s。代码段无法正常工作。但是您可以从中复制代码并在本地尝试。