当前位置: 动力学知识库 > 问答 > 编程问答 >

angularjs - What does a circumflex in a require property mean?

问题描述:

I am looking at some AngularJS-based code. It contains the following line:

require: '^wizard',

In this line, what does the circumflex character (^) mean?

This sounds like a question that should be easily answered by a glance into the documentation. Unfortunately, using the search feature on AngularJS.org to look for circumflex does not yield a single hit. Looking directly for ^ returns many results, but at least the first few of them that I checked do not even appear to contain that symbol - hence, I guess the circumflex character is simply ignored in the search. Likewise, when searching directly in Google for angularjs circumflex, I am finding questions on Delphi, encoding problems related to circumflex characters, resources on accented characters, etc.

网友答案:

(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.)

In here, The directive has a require option with value ^wizard. When a directive uses this option, $compile will throw an error unless the specified controller is found.

Reference: https://docs.angularjs.org/guide/directive

分享给朋友:
您可能感兴趣的文章:
随机阅读: