简体   繁体   English

Angular JS指令的return语句中的'^^'是什么意思

[英]What is the meaning of '^^' in return statement of Angular JS Directive

I have seen the following code somewhere in my code but i am not able to find any help on google or anywhere. 我在代码中的某处看到了以下代码,但无法在Google或任何地方找到任何帮助。

    app.directive('widget', [function () {
    return {
        require: '^^dashboard',

There you can see '^^' symbol used in required attribute. 在那里,您可以看到必需属性中使用的'^^'符号。 I need to understand the purpose. 我需要了解目的。

From the docs : 文档

The myPane directive has a require option with value ^^myTabs. myPane指令具有值为^^ myTabs的require选项。 When a directive uses this option, $compile will throw an error unless the specified controller is found. 当指令使用此选项时,除非找到指定的控制器,否则$ compile将引发错误。 The ^^ prefix means that this directive searches for the controller on its parents. ^^前缀表示此指令在其父级上搜索控制器。 (A ^ prefix would make the directive look for the controller on its own element or its parents; without any prefix, the directive would look on its own element only.) (前缀^将使指令在其自身的元素或父元素上寻找控制器;没有任何前缀,指令将仅在其自身的元素上寻找。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM