Skip to content

Instantly share code, notes, and snippets.

@RavenHursT
Last active August 29, 2015 13:58
Show Gist options
  • Select an option

  • Save RavenHursT/10191315 to your computer and use it in GitHub Desktop.

Select an option

Save RavenHursT/10191315 to your computer and use it in GitHub Desktop.
directive wrapper example
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