ui-sref链接不工作在ipad上 [英] ui-sref link not working on ipad

查看:143
本文介绍了ui-sref链接不工作在ipad上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的(phonegap)应用程序在我的浏览器(Chrome + Ripple)以及我的Android平板电脑上正常工作。但是,当使用xCode构建应用程序并在iPad上运行时,该链接不再工作。

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

显示错误:

  config:Object 
data:
header:function(c){a ||(a = vc(b)); return c?a [D ] || 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},
' ':{templateUrl:views / seminars / side.html}
}
})

查看:

 < a href ui-sref =研讨会({id:seminarCtrl.seminar.id })>开始< / a> 

在登录表单上,

  ng-submit()

>

我找不到任何与此问题相关的其他问题。



预先感谢您。



- Update 1 -



以下是 $ stateChangeError 函数引发的错误消息的屏幕截图:



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

$

b
$ b

我的新路由器:

  .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}
}
})

问题隐藏在第二条路线中。一开始我写了

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

导致错误的网址

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



另外,seminar_id将自动传递到第二个路由,并且在$ stateParams中可用。



希望有人可以使用此信息。


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

I guess 404 means "state not found"?

Route:

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

View:

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

On the login-form,

ng-submit()

is working fine.

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

Thank you in advance.

-- Update 1 --

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

解决方案

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

My new router:

.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}",

which lead to a wrong url

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

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

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天全站免登陆