网址已更改,但视图未更改 [英] URL changes but view does not change

查看:49
本文介绍了网址已更改,但视图未更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这就是我定义href标记的方式.

This is how I define the href tag.

<ion-item ng-repeat="chapter in chapters" ng-href="#/tab/kurals">
    {{chapter}}
</ion-item>

当我单击该项目时,浏览器的URL更改为/tab/kurals,但视图中没有任何变化.仍然显示旧视图.对于离子选项卡,我有一条抽象的路线.所有其他链接都可以正常工作.

When I click on the item, the url of the browser changes to /tab/kurals, but there is no change in the view. Still the old view is shown. For ionic tabs, I have an abstract route. All other links works fine.

下面是我定义路线的方式.

Below is how I defined my routes.

$stateProvider.state('tab.kural', {
    url: '/kurals',
    views: {
        'tab-kural': {
            templateUrl: 'templates/tab-kural.html',
            controller: 'KuralCtrl'
        }
    }
});

我也尝试过这个.

$stateProvider.state('tab.kural', {
    url: '/kurals',
    templateUrl: 'templates/tab-kural.html',
    controller: 'KuralCtrl'
});

控制台中没有错误.

可能是什么原因?

推荐答案

ng-href =#/tab/kurals" 将不匹配 url:'/kurals',您可以更改其中的任何内容,例如 url:'/tabs/kurals' ng-href =#/kurals" .最好的方式使用ui-serf ="tab.kural".

ng-href="#/tab/kurals" will not gonna match url: '/kurals' you can change any of then for it like url:'/tabs/kurals' or ng-href="#/kurals". Else best way it to u use ui-serf="tab.kural".

我假设您的子视图名称为"tab-kural".

I am assuming your child view name is "tab-kural".

这篇关于网址已更改,但视图未更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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