您的位置:首页 > Web前端 > AngularJS

AngularJS -- Directive参数

2016-05-16 11:34 489 查看
angular.module('myApp', [])
.directive('myDirective', function() {
return {
restrict: String,
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: // 返回一个对象或连接函数,如下所示:
  function(tElement, tAttrs, transclude) {
  return {
      pre: function(scope, iElement, iAttrs, controller) { ... },
     post: function(scope, iElement, iAttrs, controller) { ... }
    }
  return function postLink(...) { ... }
}
};
});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: