【问题标题】:Ionic nested views load on each other离子嵌套视图相互加载
【发布时间】:2015-11-16 06:43:03
【问题描述】:

这是我的Plunker

        .state('tabs', {
            url: "/tab",
            abstract: true,
            cache: false,
            templateUrl: "tabs.html"
//            controller: 'AppCtrl'
        })

        .state('tabs.home', {
            url: "/home",
            cache: false,
            views: {
                'home-tab': {
                    templateUrl: "home.html"
//                    controller: 'welcomeController'
                }
            }

        })

        .state('tabs.list', {
            url: "/list",
            cache: false,
            views: {
                'category-tab': {
                    templateUrl: "list.html"
//                  
                }
            }

        })


    // if none of the above states are matched, use this as the fallback
    $urlRouterProvider.otherwise('/tab/home');  

现在,当我在视图之间切换时,视图会相互加载,您可以同时看到它们。或者更好的说法是:网址改变但视图不变。

我错过了什么吗?谢谢

【问题讨论】:

    标签: angularjs ionic-framework ionic angular-routing angular-ui-router


    【解决方案1】:

    好像您忘记将 list.html 内容包装在 ion-view

    List.html

    <ion-view>
      <ion-header-bar align-title="center" class="bar-royal">
        <h1 class="title">
    list
    </h1>
      </ion-header-bar>
      <ion-content class="">
        <button class="button btn-custom button-full button-assertive icon icon-left ion-android-bicycle no-border red-custom no-margin">
          Sport
        </button>
      </ion-content>
    </ion-view>
    

    Demo here

    【讨论】:

    • 谢谢,现在当您点击类别并点击主页后,主页不会加载
    • 现在可以使用这个了:
    • 我能问你点什么吗?如何添加子页面但不在选项卡中?
    猜你喜欢
    • 2023-03-20
    • 2015-09-09
    • 1970-01-01
    • 1970-01-01
    • 2012-03-31
    • 2014-05-17
    • 2012-04-22
    • 1970-01-01
    • 2018-04-27
    相关资源
    最近更新 更多