不能的状态中访问视图角UI路由器 [英] Cant access a view within a state in angular-ui-router

查看:333
本文介绍了不能的状态中访问视图角UI路由器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想链接到一个子状态,不能弄清楚如何得到它的工作。这里是链接:

I am trying to link to a substate and can't figure out how to get it to work. Here is the link:

<a ui-sref="tab.communityDashboard" class="button button-block button-large"><i class="icon ion-home"></i><br />Community Directory</a>

和这里的路线:

  .state('tab', {
    url: '/tab',
    abstract: true,
    templateUrl: 'templates/tabs.html'
  })

  // Each tab has its own nav history stack:

  .state('tab.communityDashboard', {
    url: '/communitydashboard',
    views: {
      'tab-communityDashboard': {
        templateUrl: 'templates/tab-dash.html',
        controller: 'DashCtrl'
      }
    }
  })

然后最终:

$urlRouterProvider.otherwise('/home');

下面是该视图的内容:

<ion-view view-title="tab-communityDashboard">
    <ion-content>
        yolo yolo yolo
    </ion-content>
</ion-view>

我想也要去到localhost:8100 /#/ communitydashboard,但它只是重定向我回家。我该如何解决这个问题。

I tried also going to localhost:8100/#/communitydashboard but it just redirects me home. How do I fix this.

推荐答案

您需要一个&LT;离子NAV-视图&gt; 您希望您的视图展现出来,因为你正在使用的观点与你的状态,你需要包括名称属性与视图的名字,所以像&LT;离子导航视图名称=制表communityDashboard &GT;

You need an <ion-nav-view> where you want your view to show up, and since you're using views with your states, you'll need to include the name attribute with the name of the view, so something like <ion-nav-view name="tab-communityDashboard">

http://ionicframework.com/docs/api/directive/ionNavView/

http://learn.ionicframework.com/formulas/navigation -and路由部分-1 /

这篇关于不能的状态中访问视图角UI路由器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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