Reputation: 11
This is how I have done the coding.
Please I need someones help for this.
Below is the HTML and Javascript code
<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 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'
};
})
This is what I get after I have run the code
Upvotes: 0
Views: 2694
Reputation: 454
Please, consider the following code, which should work:
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>
Changes, compared to your code:
$scope.model= "text";
p.s. Snippet is not working properly. But you can copy code from it and try locally.
Upvotes: 2