Skip to content

Instantly share code, notes, and snippets.

@0xBADC0FFEE 0xBADC0FFEE/ngd.js
Created Apr 28, 2014

Embed
What would you like to do?
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
You can’t perform that action at this time.