开发者社区> 问答> 正文

angularjs ionic 做的项目,路由跳转到子页面有问题!?报错

按照例子,我在app.js中设置了俩个页面的路由:

   .state('tab.user', {
                url: '/user',
                views: {
                    'tab-user': {
                        templateUrl: 'templates/user/user.html',
                        controller: 'UserCtrl'
                    }
                }
            })

            .state('userdetail',{
                url:'/userdetail/:uaid',
                templateUrl:'templates/user/userdetail.html',
                controller:'UserdetailCtrl'
            })

控制器也相应设置后,在user.html页面里的列表设置跳转:

<li class="item item-thumbnail-left" ng-repeat="item1 in item1s" style="background-color:#fcfcfc;" ui-sref="#/userdetail/{{item1.gameId}}" >

但是点击后就报错:Error: Could not resolve '#/userdetaill/11001' from state 'tab.user'
transitionTo@file :。。。。。

假如我写成ui-sref="userdetail"就可以过去,但这样过去带不了$stateParams了,我是错在哪里了,求大神指教!

展开
收起
爱吃鱼的程序员 2020-06-10 14:51:36 632 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    <spanstyle="font-size:13.3333px;">你这种写法是直接写ng-><spanstyle="font-family:'MicrosoftYaHei',Verdana,sans-serif,SimSun;font-size:14px;line-height:22px;background-color:#FFFFFF;">#/userdetail/{{item1.gameId}}<spanstyle="font-size:13.3333px;">"而不是ui-sref,ui-sref="userdetail({uaid:item1.gameId<spanstyle="font-size:13.3333px;">})"应该这样写非常非常感谢!使用后面的ui-sref="..."解决,因为其他语言转过来的,angularjs语法基础薄弱问这样问题,多谢啦!http://www.ionic.wang/course-index.html#cours 基础教程还得好好看看
    <atarget="_blank"rel="nofollow">http://www.ionic.wang/course-index.html#cours

    2020-06-10 14:51:52
    赞同 展开评论 打赏
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载