我一直在尝试将tinymce与angularjs集成在一起,但是失败了 收到错误消息:
angular.min_1.js:123 Error: [$controller:ctrlreg] http://errors.angularjs.org/1.6.4/$controller/ctrlreg?p0=tinyEditorController
at angular.min_1.js:6
at angular.min_1.js:93
at Object.<anonymous> (viewDirective.ts:378)
at angular.min_1.js:17
at ra (angular.min_1.js:85)
at n (angular.min_1.js:70)
at g (angular.min_1.js:61)
at angular.min_1.js:61
at angular.min_1.js:66
at updateView (viewDirective.ts:301) "<ui-view class="ng-scope">"
(anonymous) @ angular.min_1.js:123
I have put the source file in the html and using a UI router handled the controller and html. Have pasted the code below
HTML file:
<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 -->
</head>
<body>
<form>
<textarea ui-tinymce="tinymceOptions" class="text1" id="mytextarea" ng-model="model">Hello, World!</textarea>
</form>
</body>
</html>
tinyEditorController file:
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";
})
路由器文件:
state('tinymceEditor',{ 网址:“ / tinymce_editor”, templateUrl:“ / views / tinyEditor.html”, 控制器:“ tinyEditorController” });
输出:
获取纯文本区域
请让我知道我需要在哪里更改代码
我想要浏览器上的编辑器