2017-02-10 39 views
0

這是我的代碼上的一個按鈕如何導航到新屏幕上的按鈕的點擊離子

<a href="tranaddnew.html" class="btn btn-success">Add a new</a> 

我得到以下輸出的點擊調用的頁面。

Cannot GET /tranaddnew.html 

誰能幫我如何導航到新屏幕上ionic點擊按鈕?

+0

改進語法,添加新的標籤 –

回答

0

你需要在你的ngModules定義路由這樣的好地方:

const routes: Routes = [ 
    {path: 'tranaddnew', component: tranaddnewPage}, 
]; 

@NgModule({ 
    declarations: [ 
    tranaddnewPage, 
    ], 
    imports: [ 
    RouterModule.forChild(routes), 
    ] 
}) 
export class HomeModule { 
} 

這將調用將被包括在HTML模板組件(你不要調用一個html文件)。

然後你可以使用類似這樣的模板:

[routerLink]="['tranaddnew']"