Angularjs “我们为什么要这样做?”;要求;指令中的ngModel与注入它?

Angularjs “我们为什么要这样做?”;要求;指令中的ngModel与注入它?,angularjs,angularjs-directive,Angularjs,Angularjs Directive,为什么我们在指令中“需要”ngModel,而不是在指令注入参数中 angular.module('customControl', ['ngSanitize']). directive('contenteditable', ['$sce', function($sce) { return { restrict: 'A', // only activate on element attribute require: '?ngMod

为什么我们在指令中“需要”ngModel,而不是在指令注入参数中

 angular.module('customControl', ['ngSanitize']).
      directive('contenteditable', ['$sce', function($sce) {
        return {
          restrict: 'A', // only activate on element attribute
          require: '?ngModel', 

指令不会被注入。它们放置在元素上,这意味着您需要自定义指令中的特定实例


require
ing另一个指令在您自己的自定义指令上是如何告诉Angular,要在元素上使用您的指令,需要另一个指令才能正常工作。

那么ngModel是一个提供一些特殊控制器和功能的指令吗?我很困惑,因为我的指令有:require:'ngModel',但在链接功能中的任何地方都不使用ngModel,但在用例中使用: