UI的SREF链接无法使用iPad上 [英] ui-sref link not working on ipad

查看:213
本文介绍了UI的SREF链接无法使用iPad上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我(的PhoneGap)应用工作在我的浏览器(Chrome +脉动),以及在我的Andr​​oid平板电脑的罚款。然而,当建立与X code中的应用程序,并在iPad上运行该链接不工作了。

My (phonegap) application is working fine in my browser (Chrome+Ripple) as well on my android tablet. However the link isn't working anymore when build the app with xCode and run it on the iPad.

$rootScope.$on('$stateChangeError', function(){..});

显示了一个错误:

shows an error:

config: Object
data: ""
headers: function (c) {a||(a=vc(b));return c?a[D(c)]||null:a;}
status: 404
statusText: ""
__proto__: Object

我猜 404 的意思是状态未找到?

路线:

.state('seminar', {
    url: "/seminar/{id}",
    views: {
        'nav@':  { templateUrl: "views/navigation/main.html" },
        'main@': { templateUrl: "views/seminars/main.html" },
        'side@': { templateUrl: "views/seminars/side.html" }
    }
})

查看:

<a href ui-sref="seminar({ id: seminarCtrl.seminar.id})">Start</a>

在登录形式,

ng-submit()

工作正常。

我无法找到与此问题相关的任何其他问题。莫不是与iOS和UI的SREF / UI路由器有问题?

I couldn't find any other questions related to this problem. Could there be a problem with iOS and ui-sref/ui-router?

感谢您提前。

- 更新1 -

下面是抛出的错误消息的屏幕截图中的 $ stateChangeError 的功能:

Here is a screenshot of the error message thrown by the $stateChangeError function:

推荐答案

我无法找到一个答案,为什么它在浏览器,但不能在iOS上的工作,但我设法找到一个解决方案。

I couldn't find an answer why it is working in the browser but not on iOS, but i managed to find a solution.

我的新的路由器:

.state('seminar', {
        url: "/seminar/{seminar_id}",
        views: {
            'nav@':  { templateUrl: "views/navigation/main.html" },
            'main@': { templateUrl: "views/seminars/main.html" },
            'side@': { templateUrl: "views/contact/side.html" }
        }
    })
    .state('seminar.course', {
        url: "/course/{course_id}",
        views: {
            'main@': { templateUrl: "views/courses/main.html" },
            'side@': { templateUrl: "views/courses/side.html" }
        }
    })

问题是隐藏在第二条路线。起初,我写了

The problem was hidden in the second route. At first I had written

url: "seminar/{seminar_id}/course/{course_id}",

这导致错误的URL

which lead to a wrong url

/seminar/1/seminar/1/course/5

它工作于iOS中移除该网址的第一部分之后。

It worked for iOS after removing the first part of the url.

另外提一下,该seminar_id将交由自动第二条路线,是在$ stateParams可用。

Also to mention, the seminar_id will be handed to the second route automatically and is available in the $stateParams.

希望有人可以使用这些信息。

Hopefully someone can use this information.

这篇关于UI的SREF链接无法使用iPad上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆