首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何让Kendo编辑器从$scope角度更新?

如何让Kendo编辑器从$scope角度更新?
EN

Stack Overflow用户
提问于 2015-04-10 12:27:15
回答 1查看 750关注 0票数 0

我有下面的代码。

html

代码语言:javascript
复制
<textarea ng-bind-html="html" style="height:440px" kendo-editor k-   options="editorOptions"></textarea>

JS

代码语言:javascript
复制
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,编辑器的内容就不会改变。我怎样才能让这一切发生?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-04-10 13:10:56

嗯,我已经创建了一个dojo,并可以相应地复制您的应用程序。并创建了一个按钮来更改控制器中的html。

代码语言:javascript
复制
 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";
            };
    });

道场

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29561441

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档