Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@0xBADC0FFEE
Created April 28, 2014 15:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0xBADC0FFEE/11374993 to your computer and use it in GitHub Desktop.
Save 0xBADC0FFEE/11374993 to your computer and use it in GitHub Desktop.
directive('$directiveName$', function factory($injectables$) {
return {
// priority: 0,
// restrict: 'A', // Attribute (default): <div my-directive="exp"></div>
// restrict: 'E', // Element name: <my-directive></my-directive>
// restrict: 'C', // Class: <div class="my-directive: exp;"></div>
// template: '<div></div>',
// or
// template: function (tElement, tAttrs) {},
// or
// templateUrl: 'directive.html',
// or
// templateUrl: function(tElement, tAttrs) {},
// replace: true, // the template will replace the current element
// replace: false, // the template will replace the contents of the current element
// transclude: true,
// transclude: 'element',
// scope: false,
// or
// scope: {
// attr: '@attr', // one way binding
// attr: '=attr', // two way binding
// attr: '&attr' // expression
// },
// controller: function ($scope, $element, $attrs, $transclude, otherInjectables) {},
// controllerAs: 'stringAlias',
// require: 'siblingDirectiveName',
// or
// require: [
// '^parentDirectiveName',
// '?optionalDirectiveName',
// '?^optionalParent'
// ],
// compile: function compile (tElement, tAttrs, transclude /*DEPRECATED*/) {
// return function postLink () {};
// },
// or
// compile: function compile (tElement, tAttrs, transclude) {
// return {
// pre: function preLink (scope, iElement, iAttrs, controller) {},
// post: function postLink (scope, iElement, iAttrs, controller) {}
// };
// },
// link: function postLink (scope, iElement, iAttrs, controller, transcludeFn) {}
// or
// link: {
// pre: function preLink(scope, iElement, iAttrs, controller) { ... },
// post: function postLink(scope, iElement, iAttrs, controller) { ... }
// }
};
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment