Last active
August 29, 2015 14:25
-
-
Save tylerdmace/016a73cdcc7368760d6a to your computer and use it in GitHub Desktop.
{{::bindOnce}}
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
'use strict'; | |
module.exports = function(ngModule) { | |
ngModule.directive('myDirective', [function() { | |
var elementId = 0; | |
return { | |
restrict: 'E', | |
scope: { | |
data: '=' | |
}, | |
template: '<div id="{{::uniqueId}}"></div>', | |
replace: true, | |
link: function(scope, element, attrs) { | |
scope.uniqueId = 'unique-element-' + elementId++; | |
// Once the DOM is ready... | |
element.ready(function() { | |
somethingThatRequiresAnElementId(scope.uniqueId); | |
} | |
} | |
}; | |
}]); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment