如何在指令中要求组件?您可以在另一个指令中要求指令的控制器,并且您可以在另一个组件中需要一个组件。但是如何在指令中要求组件控制器?
指令:
export class Directive {
require = "^^parentComponent";
restrict = "A";
link = (scope, element, attrs, parentComponent) => {
}
app.directive("someDirective", /* Init code omitted for brewity */);
}
Html:
<parent-component>
<div some-directive> </div>
</parent-component>
我收到以下错误:
Error: [$compile:ctreq] Controller 'parentComponent', required by directive 'someDirective', can't be found!
http://errors.angularjs.org/1.5.0/$compile/ctreq?p0=InvoiceCre
答案 0 :(得分:-1)