Skip to content

Instantly share code, notes, and snippets.

@pertrai1
Created March 11, 2014 12:08
Show Gist options
  • Select an option

  • Save pertrai1/9484348 to your computer and use it in GitHub Desktop.

Select an option

Save pertrai1/9484348 to your computer and use it in GitHub Desktop.
Angular Directive Options
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