我目前正在使用Ionic構建應用程序。我的問題是$ state.go只能在瀏覽器中使用,而不能在手機上使用。這似乎是一個常見問題,但在閱讀了很多相同問題的答案之後,我仍然無法弄清楚如何解決這個問題。
一般修補程序似乎是要確保您使用相對URL,如下所述:Using Angular UI-Router with Phonegap但我仍無法使其工作。我錯過了什麼?
鏈接plunker:http://plnkr.co/edit/qFJ1Ld6bhKvKMkSmYQC8?p=preview
App.js結構:
....
$stateProvider
.state('parent', {
url: "/",
templateUrl: "parent.html"
})
.state('parent.child', {
url: "child",
templateUrl: "child.html"
})
$urlRouterProvider.otherwise("/")
})
....
你有三編輯做一個函數$ state.go? – carton
還沒有 - 會嘗試做到這一點! – kandersen
我更新了plunker,因此$ state.go在'menu 1'的函數中。在設備上進行測試時,只有在點擊菜單後,在滑動手指或滑動後纔會出現。所以場景是這樣的,我點擊菜單1 - 沒有任何反應 - 向上或向下滑動,然後出現視圖。我在手機上使用Ionic View – kandersen