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

标签 javascript angularjs

我在我的代码中的某处看到了以下代码,但我无法在谷歌或任何地方找到任何帮助。

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

在那里您可以看到必需属性中使用的“^^”符号。我需要了解目的。

最佳答案

来自the docs :

The myPane directive has a require option with value ^^myTabs. When a directive uses this option, $compile will throw an error unless the specified controller is found. 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.)

关于javascript - Angular JS指令的return语句中的 '^^'是什么意思,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40989977/

相关文章:

javascript - Angular 自定义指令模板行为

javascript - Angular 生成多个 ng-repeats

javascript - 工厂方法中的数据更改后 AngularJS 范围不更新

javascript - 用 R 抓取 javascript

javascript - 如何使用可调用方法创建对象,但我也可以像函数一样调用它

javascript - 将 jquery 调用发送到外部 url

javascript - 等待 Angular JS 中的函数完成

javascript - 单击并按下一个键时使用 remove() 删除元素

javascript - IScroll 内部 IScroll : prevent parent from scrolling

javascript - 你如何在angularjs中旋转图像