Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function () {
- /**
- * a plugin for kendo that will return a .dataItem() from a widget
- * if it is available, and bind it to a model property on the current
- * scope.
- **/
- angular.module('ui.kendo', ['kendo.directives'])
- .directive("kDataItem", ["$parse", function ($parse) {
- return {
- restrict: "A",
- scope: false,
- link: function (scope, element, attributes) {
- var getter = $parse(attributes.kDataItem);
- var setter = getter.assign;
- scope.$on('kendoWidgetCreated', function (event, widget) {
- if ($.compare(widget.element, element)) {
- widget.bind('change', function (e) {
- scope.$apply(function () {
- setter(scope, e.sender.dataItem().toJSON());
- });
- });
- }
- });
- }
- }
- }]);
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement