Created
March 11, 2014 12:08
-
-
Save pertrai1/9484348 to your computer and use it in GitHub Desktop.
Angular Directive Options
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
| angular.module('appName', []) | |
| .directive('myDirective', function() { | |
| return { | |
| restrict: Strung, | |
| priority: Number, | |
| terminal: Boolean, | |
| template: String or Template Function: | |
| function(tElement, tAttrs) { | |
| } | |
| templateUrl: String, | |
| replace: Boolean or String, | |
| scope: Boolean or Object, | |
| transclude: Boolean, | |
| controller: String or function(scope, element, attrs, transclude, otherInjectables) { | |
| } | |
| controllerAs: String, | |
| require: String, | |
| link: function(scope, iElement, iAttrs) { | |
| } | |
| compile: // return an Object OR the link function as in below: | |
| function(tElement, tAttrs, transclude) { | |
| return { | |
| pre: function(scope, iElement, iAttrs, controller) { | |
| } | |
| post: function(scope, iElement, iAttrs, controller) { | |
| } | |
| // or | |
| return function postLink() { | |
| } | |
| } | |
| } | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment