我們試圖將我們的Angular 2應用程序(由我們的一個朋友寫的,因此我們可能不知道所有細節)移動到Ionic 2中。但是,我們尚未設法使其工作,因此下面的問題。在Ionic 2應用程序中使用Angular 2路由器有意義嗎?
- 請問Angular 2路由器在Ionic 2中工作嗎?
- 在Ionic 2應用程序中使用Angular 2路由器是否有意義,或者我們應該直接找到替代方案,如DeepLinker?
編輯:我不知道目前的狀態是什麼,但我讀here說:
«的角度路由器是目前大量的開發和重構。作爲其結果,角的路由器當前內離子禁用。»
凡在代碼/元數據/構建腳本/
package.json
是入口點,其激活路由器?我們在NgModule路由,但它似乎並沒有被踢成行動,當我們訪問應用程序的主網址或子網址:@NgModule({ declarations: [ AppComponent, TestComponent, AgendasListComponent, TasksListComponent, SnackBarComponent, ConfirmationDialog, AgendaComponent, LoginComponent ], entryComponents: [ ConfirmationDialog ], imports: [ BrowserModule, HttpModule, MaterialModule.forRoot(), AngularFireModule.initializeApp(firebaseConfig, firebaseAuthConfig), RouterModule.forRoot([ { path: '', redirectTo: 'agendas', pathMatch: 'full', canActivate:[ RouterGuardService ] }, { path: 'agendas', component: AgendasListComponent, canActivate:[ RouterGuardService ] } ...
Ionic在角度2上運行,因此代碼庫將兼容。如果您有關於離子的特定問題,請發佈一個可運行的代碼示例,以演示問題 –
謝謝@codeninja。我知道它應該可以工作,但是由於它在[這裏]所說的內容,我有些懷疑(https://forum.ionicframework.com/t/examples-for-ionic-2-with-angular-2-router/45186/ 6)關於角向路由器在Ionic中被禁用:'Angular路由器目前正處於大量開發和重構階段。因此,Angular的路由器目前在Ionic中被禁用。「不知道它是否仍然如此。 –
不確定,但是看着他們關於導航的文檔,似乎你像在iOS中那樣瀏覽導航堆棧。如果這不適合你可以選擇不使用離子,只使用科爾多瓦或類似的產品 –