https://github.com/angular/angular-cli/pull/6813循環依存関係の警告が追加されました。"showCircularDependencies":falseを使用してすべての警告を無効にすることができます。しかし、私はむしろ循環的な依存性の警告を保持しています。 以下のユースケースを修正するパターンがありますか、特定のファイルに対して循環依存プラグインを特に無効にする方法がありますか?警告:循環依存関係が検出されました - 角度Cli
forms.model.ts
import { CustomModel } from './custom.model';
import { CustomForm } from './custom.form';
export class Forms {
items: CustomForm[] = [];
public constructor(models?: CustomModel[]) {
models.forEach(model => this.items.push(new CustomForm(model)));
}
}
custom.model.ts
export class CustomModel {
nestedModels: CustomModel[];
}
カスタム:私は3つのファイルを持っている場合
最も単純なシナリオがあります。 form.ts
import { Forms } from './forms.model';
import { CustomModel } from './custom.model';
export class CustomForm {
nestedForms: Forms;
constructor(model: CustomModel) {
this.nestedForms = new Forms(model.nestedModels);
}
}
これは、次の警告の原因:
WARNING in Circular dependency detected:
src\app\models\custom.form.ts -> src\app\models\forms.model.ts -> src\app\models\custom.form.ts
WARNING in Circular dependency detected:
src\app\models\forms.model.ts -> src\app\models\custom.form.ts -> src\app\models\forms.model.ts
を私の実際のアプリケーションでは、このため同じパターンの約20~30警告があります。 私は基底のプラグインhttps://github.com/aackerman/circular-dependency-pluginがパターンを除外することをサポートしていると思うが、私は角度のcliを介してこれを使用する方法はありません。
これを確認してくださいhttps://github.com/angular/angular-cli/issues/7705 –