在CakePHP 2中我可以通过使用获取当前操作$this->action,但在CakePHP 3.x中我不能再使用它了,因为它返回以下错误:
Error: actionHelper could not be found.
Run Code Online (Sandbox Code Playgroud)
如何在CakePHP 3中获取当前操作?
我甚至不知道TypeScript中是否可以这样做,但我试图从类继承一个函数,如下所示:
import {Component, AfterViewInit, ElementRef} from 'angular2/core';
@Component({})
class Class1 {
name: string;
constructor(private el: ElementRef) {}
private setName() {
this.name = "test";
}
ngAfterViewInit() {
this.setName();
}
}
@Component({
selector: 'test'
})
export class Class2 extends Class1 {
ngAfterViewInit() {
super.ngAfterViewInit();
console.log(this.name);
}
}
Run Code Online (Sandbox Code Playgroud)
但是在调用setName()函数时我在控制台中收到以下错误:
EXCEPTION:TypeError:this.el未定义
为什么这不起作用?
angular ×1
cakephp ×1
cakephp-3.0 ×1
controller ×1
inheritance ×1
javascript ×1
php ×1
typescript ×1