2014-12-21 19 views
-2

有沒有什麼辦法可以使用ons-navigator切換頁面,而不需要ons-template標籤? 例如,我有這樣的項目:帶有onsen導航器和AngularJS的切換頁面

--app.js 
--index.html 
--page1.html 

當我描述page1.html到的index.html,使用插件模板(這樣http://codepen.io/onsen/pen/yrhtv)一切都很OK。但如果我試圖設置路徑到

myNavigator.pushPage('page1.html', { animation : 'slide' }) 

沒有使用ons模板我的應用程序不起作用。

+0

您是使用網絡服務器來提供應用程序還是隻使用瀏覽器打開文件? 您需要使用Web服務器,因爲Onsen會請求'page1.html'。 –

回答

0

您可以使用<ons-template>而不使用<ons-navigator>,但不能使用其他方法。 Navigator對象類似於Angular路由系統,它需要模板才能在頁面之間發送數據。