What is the significance of '?ngModel' when creating an AngularJS directive?

后端 未结 2 560
名媛妹妹
名媛妹妹 2021-01-18 11:42

I\'m working my way through the new ng-book. The chapter on filters includes a section on defining parsers with the following code:

angular.module(\'myApp\')         


        
2条回答
  •  再見小時候
    2021-01-18 12:12

    ? is optional directive and ^ is parent directive

    http://docs.angularjs.org/api/ng.$compile

    (no prefix) - Locate the required controller on the current element. Throw an error if not found.
    ? - Attempt to locate the required controller or pass null to the link fn if not found.
    ^ - Locate the required controller by searching the element's parents. Throw an error if not found.
    ?^ - Attempt to locate the required controller by searching the element's parents or pass null to the link fn if not found.
    

提交回复
热议问题