小编Dan*_*edo的帖子

获取CakePHP 3中的当前操作

在CakePHP 2中我可以通过使用获取当前操作$this->action,但在CakePHP 3.x中我不能再使用它了,因为它返回以下错误:

Error: actionHelper could not be found.
Run Code Online (Sandbox Code Playgroud)

如何在CakePHP 3中获取当前操作?

php controller cakephp cakephp-3.0

3
推荐指数
3
解决办法
8622
查看次数

TypeScript函数继承

我甚至不知道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未定义

为什么这不起作用?

javascript inheritance typescript angular

3
推荐指数
1
解决办法
1814
查看次数