多个抽象视图-Ionic [英] Multiple abstract views - Ionic

查看:74
本文介绍了多个抽象视图-Ionic的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ionic构建一个项目,其中ui-router处理了不同的视图,需要将它们嵌套在一起.这是处理ui-viewstates的代码部分:

I am building a project with ionic where there are different views handled by ui-router, that needs be nested together. This is the part of the code where the states of the ui-view are handled:

$stateProvider

// setup an abstract state for the tabs directive
.state('filters', {
  url: '/filters',
  abstract: true,
  templateUrl: 'templates/filters.html'
})

// and one for the search bar
.state('search', {
  url: '/search',
  abstract: true,
  templateUrl: 'templates/search.html'
})

// Each tab has its own nav history stack:
.state('filters.search.locations', {
  url: '/locations',
  views: {
    'tab-locations': {
      templateUrl: 'templates/tab-locations.html',
      controller: 'LocationsCtrl'
    }
  }
})

.state('filters.search.job-categories', {
  url: '/job-categories',
  views: {
    'tab-job-categories': {
      templateUrl: 'templates/tab-job-categories.html',
      controller: 'JobCategoriesCtrl'
    }
  }
})

.state('filters.search.levels', {
  url: '/levels',
  views: {
    'tab-levels': {
      templateUrl: 'templates/tab-levels.html',
      controller: 'LevelsCtrl'
    }
  }
});

如您所见,我的意图是结合状态filters& search并一起显示它们,但是显然我做错了.您知道我的代码有什么问题吗?

As you can see, my intention is to combine the states filters & search and display them together, but apparently I am doing something wrong. Do you know what is the issue with my code?

提前感谢您的答复!

推荐答案

检查一下:

  $stateProvider

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

    // note this ...
    .state('filters.search', {
      url: '/search',
      abstract: true,
      templateUrl: 'templates/search.html'
    })

    .state('filters.search.locations', {
      url: '/locations',
      views: {
        'tab-locations': {
          templateUrl: 'templates/tab-locations.html',
          controller: 'LocationsCtrl'
        }
      }
    })

    //and so on ...

这篇关于多个抽象视图-Ionic的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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