私たちのプロジェクトには、次のようなカスタム要素がたくさんあります。
<entity-link id="entity.id>
基本的に、エンティティ画面を編集するためのリンクをレンダリングするだけです
<template>
<a class="entity-link"
route-href="route: ENTITY_EDIT; params.bind: { id: entity.id }"
>${entity.name}
</a>
</template>
問題は、これが Aurelia Dialog コンテキスト内でまったく機能しないことです。
href
属性はまったく入力されていません。
問題を調査しようとしましたが、ルーターをダイアログのビューモデルに直接注入しました
import {Router} from 'aurelia-router';
@inject(DialogController, Router)
export default class RecordDetailsDialog {
constructor(dialogController:DialogController, router:Router) {
this.controller = dialogController;
this.router = router; /// WRONG INSTANCE!!!
}
}
Router の間違ったインスタンスが注入されていることがわかりました。メイン ルーター (AppRouter) は ENTITY_EDIT ルートを定義せず、子ルートの configureRoute 関数で動的に追加されます。
ダイアログの開始を開始するビューに渡されたルーターではなく、挿入されたルーターがメインのルーターである理由がわかりません。
アドバイスをお願いします