Skip to content

Instantly share code, notes, and snippets.

@kikill95
Created April 4, 2016 18:53
Show Gist options
  • Select an option

  • Save kikill95/a3acd496ef02328da84c20997f77b257 to your computer and use it in GitHub Desktop.

Select an option

Save kikill95/a3acd496ef02328da84c20997f77b257 to your computer and use it in GitHub Desktop.
Custom directive
angular.module('app', [])
.directive('ourDirective', function() {
return {
restrict: 'E',
transclude: false,
replace: true,
template: '<div>template</div>',
// templateURL: '../path/to/file.html',
// or function that returns the way for template
scope: {
// the scope for directive
},
link: function(scope, elem, attrs) {
// link option for registration DOM listeners as well as update the DOM
},
controller: function() {
// the controller for directive
}
// and others...
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment