2016-04-22 6 views
1

私は次のように定義されたいくつかの州があります。空のURLを持つ状態をどのようにするには?

$stateProvider 
     .state('home', { 
       url: '/' 
       , templateUrl: 'modules/trulo/client/views/browse.client.view.html' 
     }) 

     .state('search', { 
      url: '/search' 
      , templateUrl: 'modules/trulo/client/views/search.client.view.html' 
     }) 

     .state('profile', { 
      url: '/profile' 
      , templateUrl: 'modules/users/client/views/settings/edit-profile.client.view.html' 
     }) 

     .state('cart', { 
       url: '/cart' 
       , templateUrl: 'modules/trulo/client/views/cart.html' 
     }) 
     .state('orders', { 
       url: '/orders' 
       , templateUrl: 'modules/trulo/client/views/orders.html' 
     }) 

     .state('home.myshop', { 
      url: '/myshop' 
      , templateUrl: 'modules/trulo/client/views/myshop.html' 
     }); 

次に、私はボタンをクリックしたときにhomeページに戻りたいです。これは、そのボタンのui-sref属性を使用して行われます。 ui-srefに割り当てるべき値は、そのボタンをクリックするとホームページに戻ることができるはずです。

私は、次のいずれかの任意の成功を得ていないのです。

<button ui-sref="">Home</button> 
<button ui-sref="/">Home</button> 
<button ui-sref="home">Home</button> 

任意の提案をいただければ幸いです!

答えて

0

でドキュメントをチェックすることを躊躇しないであなたの

 .state('home', { 
 
       url: '/' 
 
       , templateUrl: 'modules/trulo/client/views/browse.client.view.html' 
 
     })

:家のための状態は次のように宣言されています

コードは次のようになります。

<button ui-sref="home">Home</button> 
+0

はい、あなたが正しい、私は誤ってそれを入力 –

関連する問題