首页 > 代码库 > ng-Directive

ng-Directive

伪代码:

  

var myModule = angular.module(...);myModule.directive(‘namespaceDirectiveName‘, function factory(injectables) {var directiveDefinitionObject = {restrict: string,priority: number,template: string,templateUrl: string,replace: bool,transclude: bool,scope: bool or object,controller: function controllerConstructor($scope,$element,$attrs,$transclude),require: string,link: function postLink(scope, iElement, iAttrs) { ... },compile: function compile(tElement, tAttrs, transclude) {return {pre: function preLink(scope, iElement, iAttrs, controller) { ... },post: function postLink(scope, iElement, iAttrs, controller) { ... }}}};return directiveDefinitionObject;});

  

ng-Directive