Created
February 18, 2016 16:54
-
-
Save leandroh/a02db5e48e11d541e013 to your computer and use it in GitHub Desktop.
Directive Definition Object
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
| var app = angular.module('app', []); | |
| app.directive('webComponent', function factory(dependencias) { | |
| var directiveDefinitionObject = { | |
| priority: 0, | |
| template: '<div></div>', // or // function(tElement, tAttrs) { ... }, | |
| // or | |
| // templateUrl: 'directive.html', // or // function(tElement, tAttrs) { ... }, | |
| transclude: false, | |
| restrict: 'A', | |
| templateNamespace: 'html', | |
| scope: false, | |
| controller: function($scope, $element, $attrs, $transclude, otherInjectables) { ... }, | |
| controllerAs: 'stringIdentifier', | |
| bindToController: false, | |
| 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; | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment