Last active
August 29, 2015 13:58
-
-
Save RavenHursT/10191315 to your computer and use it in GitHub Desktop.
directive wrapper example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| angular.module('angularDomEdit', []).directive('domEdit', function(){ | |
| return { | |
| restrict: 'A', | |
| scope: { | |
| mouseOver: '&domEditMouseOver', | |
| itemSelect: '&domEditItemSelect', | |
| close: '&domEditClose', | |
| elementClick: '&domEditElementClick', | |
| overlayClick: '&domEditOverlayClick', | |
| resize: '&domEditResize', | |
| resizeStop: '&domEditResizeStop', | |
| move: '&domEditMove', | |
| moveStop: '&domEditMoveStop', | |
| hoverIgnore: '@domEditHoverIgnore', | |
| clickIgnore: '@domEditClickIgnore' | |
| }, | |
| link: function (scope, elem, attrs) { | |
| console.log(scope.hoverIgnore); | |
| scope.domEditContainer = elem.domEdit({ | |
| hoverIgnore: scope.hoverIgnore, | |
| clickIgnore: scope.clickIgnore, | |
| callbacks: { | |
| mouseOver: scope.mouseOver, | |
| elementClick: function(overlay, e){ | |
| // 'this' should be the jquery element.. but it's NOT, it's $scope | |
| scope.elementClick.call(this, overlay, e); | |
| } | |
| } | |
| }); | |
| } | |
| }; | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment