Created
April 4, 2016 18:53
-
-
Save kikill95/a3acd496ef02328da84c20997f77b257 to your computer and use it in GitHub Desktop.
Custom directive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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