这让我发疯。
我的其中一个页面中有一个 HREF
<a href="#/EventAdd">Click me ## ;)</a>
这在 Chrome 上运行良好,但在 Android 上的 PhoneGap 中运行不佳。
我四处寻找,但找不到任何解决方案。
EventAdd 的状态提供程序配置如下所示。
app.config(function ($stateProvider, $urlRouterProvider) {
// For any unmatched url, redirect to /state1
$urlRouterProvider.otherwise("/home");
//
// Now set up the states
$stateProvider
.state('EventAdd', {
url: "/EventAdd",
templateUrl: "views/eventAdd.html",
controller: 'EventaddCtrl'
});
});
它不会显示任何错误,只是不会离开屏幕。
有什么建议吗?
最佳答案
尝试<a ui-sref="EventAdd">Click me ## ;)</a>
反而。如果没有 Plunker,我不确定问题是什么。
更新:
另一种选择。
查看:
<a ng-click="goToEventAdd()">Click me ## ;)</a>
Controller :
$scope.goToEventAdd = function(){
//Don't forget to inject the $state service
$state.go("EventAdd");
}
关于javascript - AngularJs、Phonegap、路由器和 uiRouter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28639965/