繁体   English   中英

如何使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进行更改。 但是,如果我从javascript更改$ scope.html,则编辑器的内容不会更改。 如何使这种情况发生?

好吧,我创建了一个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";
            };
    });

道场

一切都很好。 您的语法正确吗?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM