Skip to content

Instantly share code, notes, and snippets.

@iissnan
Last active December 31, 2015 16:49
Show Gist options
  • Select an option

  • Save iissnan/8016602 to your computer and use it in GitHub Desktop.

Select an option

Save iissnan/8016602 to your computer and use it in GitHub Desktop.
angular.module("testModule", [])
// syntax: module.directive("namespaceName", factory)
// factory will be invoked once by $compiler to create a directive for the first time match happens
// and invoked via $inject.invoke makes it injectable just like a controller.
.directive("testDirective", function directiveFactory($log) {
var directiveDefinitionObject = {};
return directiveDefinitionObject;
// or return a constructor function
// Prefer using the definition object over returning a function.
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment