2016-04-30 78 views
0

離子sidemenu默認應用程序創建和地圖和標記點擊拖拽頁面添加在菜單列表中。地圖工作正常,但MarkerClick不是。當點擊MarkerClick表單旁邊菜單時,這個重定向到最後一個活動頁面。離子頁面導航不起作用

menu.html

<ion-side-menu side="left"> 
    <ion-header-bar class="bar-stable"> 
     <h1 class="title">Left</h1> 
    </ion-header-bar> 
    <ion-content> 
     <ion-list> 
      <ion-item menu-close ng-click="login()"> 
       Login 
      </ion-item> 
      <ion-item menu-close href="#/app/search"> 
       Search 
      </ion-item> 
      <ion-item menu-close href="#/app/browse"> 
       Browse 
      </ion-item> 
      <ion-item menu-close href="#/app/playlists"> 
       Playlists 
      </ion-item> 
      <ion-item menu-close href="#/app/map"> 
       Map 
      </ion-item> 
      <ion-item menu-close href="#/app/markerClick"> 
       Marker 
      </ion-item> 
     </ion-list> 
    </ion-content> 
</ion-side-menu> 

app.js

.config(function ($stateProvider, $urlRouterProvider) { 
$stateProvider 

    .state('app', { 
     url: '/app', 
     abstract: true, 
     templateUrl: 'templates/menu.html', 
     controller: 'AppCtrl' 
    }) 
    .state('app.search', { 
     url: '/search', 
     views: { 
      'menuContent': { 
       templateUrl: 'templates/search.html' 
      } 
     } 
    }) 
    .state('app.browse', { 
     url: '/browse', 
     views: { 
      'menuContent': { 
       templateUrl: 'templates/browse.html' 
      } 
     } 
    }) 
    .state('app.playlists', { 
     url: '/playlists', 
     views: { 
      'menuContent': { 
       templateUrl: 'templates/playlists.html', 
       controller: 'PlaylistsCtrl' 
      } 
     } 
    }) 
    .state('app.single', { 
     url: '/playlists/:playlistId', 
     views: { 
      'menuContent': { 
       templateUrl: 'templates/playlist.html', 
       controller: 'PlaylistCtrl' 
      } 
     } 
    }) 
    .state('app.map', { 
     url: '/map', 
     views: { 
      'menuContent': { 
       templateUrl: 'templates/map.html', 
       controller: 'MapCtrl' 
      } 
     } 
    }) 
    .state('app.markerClick', { 
     url: '/markerClick', 
     view: { 
      'menuContent': { 
       //templateUrl: '<h1>what the hello</h1>', 
       templateUrl: 'templates/testTemplate.html', 
       controller: 'markerClickCtr' 
      } 
     } 
    }); 
// if none of the above states are matched, use this as the fallback 
$urlRouterProvider.otherwise('/app/map'); 
}); 

enter image description here

enter image description here

回答

0

嘗試更換與UI-SREF = 「app.markerClick」 UI HREF -Router提供了允許鏈接的ui-sref到各州。這與鏈接到普通URL不同。使用UI-Router時,您想鏈接到一個狀態,而不是URL。

+0

謝謝。現在正在工作 – Souras

+0

請相應標記答案 –