-
-
Save carlware/87bff18db1bddda68d61 to your computer and use it in GitHub Desktop.
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
.directive('directiveName', [function () { | |
var directiveDefinitionObject = { | |
priority: 0, | |
template: '<div></div>', // or // function(tElement, tAttrs) { ... }, | |
// or | |
// templateUrl: 'directive.html', // or // function(tElement, tAttrs) { ... }, | |
replace: false, | |
transclude: false, | |
restrict: 'A', | |
scope: false, | |
controller: ['$scope', '$element', '$attrs', '$transclude', 'otherInjectables', function($scope, $element, $attrs, $transclude, otherInjectables) {}], | |
require: 'siblingDirectiveName', // or // ['^parentDirectiveName', '?optionalDirectiveName', '?^optionalParent'], | |
compile: function compile(tElement, tAttrs, transclude) { | |
return { | |
pre: function preLink(scope, iElement, iAttrs, controller) { }, | |
post: function postLink(scope, iElement, iAttrs, controller) { } | |
} | |
// or | |
// return function postLink( ... ) { ... } | |
}, | |
// or | |
// link: { | |
// pre: function preLink(scope, iElement, iAttrs, controller) { }, | |
// post: function postLink(scope, iElement, iAttrs, controller) { } | |
// } | |
// or | |
// link: function postLink( ... ) { ... } | |
}; | |
return directiveDefinitionObject; | |
// or | |
// return function postLink( scope, iElement, iAttrs ) {}; | |
}]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment