使用Ionic的角度路由:1个用于乘法视图的模板

时间:2015-12-16 20:35:25

标签: angularjs routing ionic ionic-view

我正在开发我的第一个Ionic-App,中间有4个标签(主页,类别,聊天,个人资料)+相机按钮。

所以现在我的问题是:我如何使用一个路由,例如tabs_footer.userProfileFeed,我可以从每个标签/视图中调用,如下所示:

ui-sref="tabs_footer.userProfileFeed"

我的想法是定义这样的状态:

.state('tabs_footer.userprofileFeed', {
    url: '/userprofileFeed/:imageID',
    views: {
      'profile-tab' : {
        templateUrl: 'templates/userprofile/userprofile_gallery_detail.html'
      },
      'category-tab' : {
        templateUrl: 'templates/userprofile/userprofile_gallery_detail.html'
      },
      'notifications-tab' : {
        templateUrl: 'templates/userprofile/userprofile_gallery_detail.html'
      },
      'homeGallery-tab' : {
        templateUrl: 'templates/userprofile/userprofile_gallery_detail.html'
      }
    }
})

Tabs_Footer-code:

 <script id="tabs_footer.html" type="text/ng-template">
          <ion-tabs id="footer-nav"class="tabs-positive tabs-striped">
            <ion-tab icon="ion-ios-home-outline" ui-sref='tabs_footer.homeGallery'>
              <ion-nav-view name="homeGallery-tab"></ion-nav-view>
            </ion-tab>
            <ion-tab icon="ion-compass" ui-sref='tabs_footer.category'>
              <ion-nav-view name='category-tab'></ion-nav-view>
            </ion-tab>
            <ion-tab ng-controller='CameraCtrl' icon="ion-ios-camera-outline" ng-click='getPhoto()'>
              <ion-nav-view name="camera-tab"></ion-nav-view>
            </ion-tab>
            <ion-tab icon="ion-ios-chatboxes-outline" ui-sref='tabs_footer.directChat'>
              <ion-nav-view name="notifications-tab"></ion-nav-view>
            </ion-tab>
            <ion-tab icon="ion-ios-person-outline" ui-sref='tabs_footer.ownprofile'>
              <ion-nav-view name="profile-tab"></ion-nav-view>
            </ion-tab>
          </ion-tabs>
        </script>

这里是tabs_footer的状态:

.state('tabs_footer', {
    url: '/tabsFooter',
    abstract: true,
    templateUrl: 'tabs_footer.html'
})

但似乎他们我错了。 怎么能解决这个问题呢?

所以在结论中:

我希望通过ui-sref =&#34; tabs_footer.userProfileFeed&#34;

来调用我想要调用的所有视图的状态

请帮帮我! :)

诚恳,

哈德

0 个答案:

没有答案