Created
May 28, 2014 21:57
-
-
Save ericz/2276a0da3134baef1e79 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
# | |
# as | |
# | |
# When added as attribute to custom directive, exposes the isolate scope of the directive to parent scope | |
# | |
# Attributes: | |
# as: Name to save isolate scope as on parent scope | |
## | |
# Example: | |
### | |
<element | |
as="testPopup"> | |
</element> | |
# The isolate scope of popup is now exposed as $scope.testPopup on parent | |
### | |
module.exports = (app) -> | |
app.directive('as', () -> | |
component = | |
restrict: 'A' | |
link: (scope, element, attrs) -> | |
scope[attrs.as] = element.isolateScope() | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment