2016-03-19 13 views
1

私は、UIルータの抽象状態の仕組みを理解するのにいくつかの困難を抱えています。 ここには物があります: 私は<body>の中に<ui-view>タグだけを持つindex.htmlを持っています。UIルータの抽象状態の子はレンダリングしません

ランディングとアプリ(/ランディングと/ app)の2つの主要な状態があります。

スタンドアロンファイル(子ビューなしなど)のため、現在は着陸状態に問題はありません。

私の/ appステートでは、アプリケーション全体をカバーする抽象的な親ステートが必要です(各子ステートメントのユーザープロファイルを解決する必要があります)。

この抽象的な状態の子もサブビューを持つことです。そして私はそれらをレンダリングさせることはできません。

マイ$ stateProviderの設定(簡体字):

//landing state, no problem here 
.state('landing', { 
    url: '/landing', 
    templateUrl: 'landing.html' 
}) 
// my abstract parent state, with the resolve 
.state('root', { 
    url: '', 
    abstract: true, 
    template: "<div ui-view></div>", 
    resolve: { 
     current_user: function (UserFactory) { 
      return UserFactory.initCurrentUserProfile(); 
     } 
    } 
}) 

// the child which cannot render the view headerAndSearchbar 
.state('root.app', { 
    url: '/app', 
    templateUrl: 'app.html', 
    views: { 
     'headerAndSearchbar': { 
      templateUrl: './partials/header/headerAndSearchbar.html' 
     } 
    } 
}) 

app.html:私は宣言状態root.appでのビューを削除する場合

<div ui-view="headerAndSearchbar"> </div> <div> This is app.html </div> 

、私が見ることができますtext "これはapp.htmlです"。 headerAndSearchbar.htmlには単純なhtmlのみが含まれています& css

アイデアをお持ちですか?私はこれに頭を叩いています - 何が分からないのですか?

答えて

関連する問題