How to disable Kendo AngularJS UML editor

I tried to use k-content-editable, and also only general data-ng-disabled, but none of them worked. Looking at the documentation, it’s not even clear to me if there is a way to turn off control.

+4
source share
2 answers

You can do this by creating a custom directive:

   .directive("kNgDisabled", function() {
      return {
        restrict: "A",
        link: function(scope, element, attr) {
          scope.$on("kendoWidgetCreated", function(e, widget) {
            var value = scope.$eval(attr.kNgDisabled);

            $(widget.body).attr("contenteditable", !value);

            scope.$watch(attr.kNgDisabled, function(value) {
              $(widget.body).attr("contenteditable", !value);
            });
          })
        }
      }
    });

Then use it as follows:

<textarea kendo-editor k-ng-disabled="disabled"></textarea>

Here is a live demo: http://dojo.telerik.com/@korchev/AdApu

+5
source

Add the following code to your Angular controller ->

 var x = document.getElementById("myForm");
    x.addEventListener("focus", myFocusFunction, true);

    function myFocusFunction() {
         $($('#keFinding').data().kendoEditor.body).attr('contenteditable', false);  
    }
+1
source

All Articles