2016-08-12 2 views

答えて

1

これは組み込みのtslintルールではありません。それはcodelyzerによって定義されるルールです。

GitHubリポジトリにはビデオ(私が見たことのないもの)がありますが、ほとんどドキュメントはありません。幸いなことに、著者はテストを実施しているので、use-life-cycle-interface ruleから何を推測することが可能ですそのtest descriptions:それは単にあなたが使うすべてのライフサイクルフック用implementsキーワードを追加する必要があることを意味

it(`should fail, when a life cycle hook is used without implementing it's interface`, ... 
it(`should fail, when life cycle hooks are used without implementing their interfaces`, ... 
it(`should fail, when some of the life cycle hooks are used without implementing their interfaces`, ... 
+0

も絶対に私はJohnPapaから集中WebStormためNG2-テンプレートを使用して、彼らはこのルールの後に無効になり、私のために針:) –

1

これは角度でフックを認識して使用する必要はありませんが、コードの明瞭性とメンテナンスの方がはるかに優れています。

例:

// don't forget the import 
import { AfterViewInit } from '@angular/core'; 
// you have to have this implements statement 
export class YourComponent implements AfterViewInit { 
    // if you want to use this hook 
    ngAfterViewInit() { 
    // your code... 
    } 
} 
関連する問題