2017-10-16 31 views
0

例如:在協議列表中創建並在同一頁面創建協議。我想在保存新協議後重新加載 協議列表。試試這個this.router.navigate('/ agreement/client/10'),但是這不會加載新列表,因爲它正在導航相同的url。如何在Aurelia路由同一網頁並更新內容

+0

的可能的複製[刷新在奧裏利亞當前頁面(https://stackoverflow.com/questions/38845637/reload-current -page-in-aurelia) – adiga

回答

0

在你configureRouter方法中,添加activationStrategy.replace給需要此功能路線:

import {activationStrategy} from 'aurelia-router'; 

export class MyClass { 
    configureRouter(config) { 
     config.map([{ 
      route: 'my-route', 
      name: 'my-name', 
      activationStrategy: activationStrategy.replace, 
      title: 'My Title', 
      moduleId: 'myModule', 
     }]); 
    } 
} 
+0

謝謝。這個解決方案工作正常。當我試圖保存一個協議時,這是工作。當我再次更改該協議時,這不起作用。任何解決方案? –

0

您可以使用Event Aggregator,並在添加新協議時發佈事件,並在事件觸發時重新加載列表。