如何让 Kendo 编辑器从 angular $scope 更新
How do I get the Kendo editor to update from angular $scope
我有以下代码。
html
<textarea ng-bind-html="html" style="height:440px" kendo-editor k- options="editorOptions"></textarea>
JS
angular.module('SplashApp', ['ngRoute', 'kendo.directives', 'ngSanitize'])
.controller("MainController", function ($scope, $location, $route, $http, $sce) {
$scope.html = "<h1>Kendo Editor</h1>\n\n" +
"<p>Note that 'change' is triggered when the editor loses focus.\n" +
"<br /> That's when the Angular scope gets updated.</p>";
});
页面呈现时没问题。如果用户更新页面,它也会对 $scope.html 进行更改。但是如果我将 $scope.html 从 javascript 更改为编辑器的内容不会改变。我如何才能做到这一点?
好吧,我已经创建了一个 dojo 并且可以相应地复制您的应用程序。并创建了一个按钮来更改控制器中的 html。
angular.module('SplashApp', ['kendo.directives', 'ngSanitize'])
.controller("MainController", function ($scope) {
$scope.html = "<h1>Kenessssdo Editor</h1>\n\n" +
"<p>Note that 'change' is triggered when the editor loses focus.\n" +
"<br /> That's when the Angular scope gets updated.</p>";
$scope.addHtml = function(){
$scope.html+= "<br>ahahahahhahah";
};
});
一切都很好。你的语法正确吗?
我有以下代码。
html
<textarea ng-bind-html="html" style="height:440px" kendo-editor k- options="editorOptions"></textarea>
JS
angular.module('SplashApp', ['ngRoute', 'kendo.directives', 'ngSanitize'])
.controller("MainController", function ($scope, $location, $route, $http, $sce) {
$scope.html = "<h1>Kendo Editor</h1>\n\n" +
"<p>Note that 'change' is triggered when the editor loses focus.\n" +
"<br /> That's when the Angular scope gets updated.</p>";
});
页面呈现时没问题。如果用户更新页面,它也会对 $scope.html 进行更改。但是如果我将 $scope.html 从 javascript 更改为编辑器的内容不会改变。我如何才能做到这一点?
好吧,我已经创建了一个 dojo 并且可以相应地复制您的应用程序。并创建了一个按钮来更改控制器中的 html。
angular.module('SplashApp', ['kendo.directives', 'ngSanitize'])
.controller("MainController", function ($scope) {
$scope.html = "<h1>Kenessssdo Editor</h1>\n\n" +
"<p>Note that 'change' is triggered when the editor loses focus.\n" +
"<br /> That's when the Angular scope gets updated.</p>";
$scope.addHtml = function(){
$scope.html+= "<br>ahahahahhahah";
};
});
一切都很好。你的语法正确吗?