Created
April 23, 2014 06:51
-
-
Save willrjmarshall/11204977 to your computer and use it in GitHub Desktop.
This file contains 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
Darkswarm.directive "ofnModal", ($modal)-> | |
restrict: 'E' | |
replace: true | |
transclude: true | |
template: "<a>{{title}}</a>" | |
# If I do this then my cancel() function goes on the isolate scope | |
# But due to transclude my transclude() content is run against the original scope | |
# So I don't have access to modalInstance | |
#scope: | |
# title: "@" | |
link: (scope, elem, attrs, ctrl, transclude)-> | |
scope.title = attrs.title | |
scope.cancel = -> | |
scope.modalInstance.dismiss("cancel") | |
elem.on "click", -> | |
scope.modalInstance = $mod | |
%ofn-modal{title: "Learn more"} | |
%h3 I'm a modal! | |
CONTENT! | |
%a.close-reveal-modal{"ng-click" => "cancel()"} × |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment