kendo-labs / angular-kendo

A project to create a robust set of Angular.js bindings for Kendo UI widgets
474 stars 209 forks source link

Editor widget binding not working after manual initialization #395

Closed jasenkoh closed 9 years ago

jasenkoh commented 9 years ago

Hello,

I am trying to build custom directive for kendo editor and after I initialize editor itself, bindings appear to be missing.

HTML:

<textarea ext-kendo-editor='{"NaturalKey": "prototype-1", "EnableAttachments": true, "EditorProfile": "Full"}'
    k-ng-model="comment.text"
    ng-model="comment.notesTxt"
    name="comment"
    id="comment"
    class='form-control'
    rows='3'></textarea>

Angular Directive:

(function () {
    var directive = function ($timeout, $compile) {
        return {
            restrict: 'A',
            scope: true,
            link: function (scope, element, attr) {
                $timeout(function () { 
                    attr.$observe('extKendoEditor', function (newValue) {
                        element.kendoEditor();
                    });
                }, 5);
            }
        };
    };

    directive.$inject = ['$timeout', '$compile'];
    angular.module('kendoApp').directive('extKendoEditor', directive);
}());

And $scope.comment is returning me empty object. Any thoughts?