拥有此控制器:
class FirstController{
constructor(){
...
}
$onInit(){
}
updateField(name) {
...
this.callback({id: name});
}
}
const firstController={
bindings: {
site: '<',
callback: '&'
},
controller:FirstController,
templateUrl:require('./FirstController.html')
};
export default firstController;
我想将callback()
方法调用到另一个方法中,所以我这样做了:
import firstController from './../core/firstController/firstController.js';
class SecondCtrl {
constructor(SecondService, ...) {
reset() {
firstController.callback();
...
}
}
它不起作用,我收到此错误消息:
未捕获的ReferenceError:未定义firstController
有什么建议吗?