1
當用戶第一次登錄時加載站點,然後登錄,下面定義的路由account
將解析爲/profile/null
。用戶必須在路徑的路徑正確之前刷新網站。登錄後在鐵路由器路由中未定義的Meteor.userId()
this.route('account', {
template: 'profile',
path: '/profile/' + Meteor.userId()
})
之所以專門創建的路線來走參數Meteor.userId()
是因爲我使用的是package,需要我定義path
名,即:{{> ionTab title="Account" path="account"}}
我不認爲可以採取的參數。
最好的方法來完善這條路線?當你的應用程序啓動
謝謝,我正在使用[package](https://github.com/meteoric/meteor-ionic),它需要我定義路徑名,例如:{{> ionTab title =「Account」path =「account」}}'我不認爲可以帶參數 – Nyxynyx
檢查我的編輯,你可以得到動態計算的路由路徑參數。路由參數名稱應該與作爲第二個參數傳遞給'Router.path'的對象的屬性匹配。 – saimeunt
當我使用'Router.path('profile',{'user_id':Meteor.userId()})'時,在瀏覽器JS控制檯中得到了正確的路徑。使用'Router.path(「profile」,Meteor.user());'雖然給了一個'null'... – Nyxynyx