Angular UI Router - Views in an Inherited State

前端 未结 4 1085
误落风尘
误落风尘 2021-02-01 07:38

edit: Based on the answer by @actor2019 I want to update my question to better explain the problem:

Using Angular UI-Router(v0.0.2), I\'ve setup the app

4条回答
  •  既然无缘
    2021-02-01 08:16

    The Child state should be home.search instead of header.search. In your case, you may want to write some abstract state to hold the layout,

    base.html

    in app.js

    $stateProvider
        .state('base',{
            abstract:true,
            url:'/',
            templateUrl: viewBase+'base.html'
        })
        .state('base.main',{
            url:'',
            views:{
                "logo":{
                    templateUrl:viewBase+'main/logo.html'
                },
                "menu":{
                    templateUrl:viewBase+'main/menu.html'
                },
                "sidebar":{
                    templateUrl:viewBase+'main/sidebar.html'
                },
                "entry":{
                    templateUrl: viewBase+'main/entry.html'
                }
            }})
    

提交回复
热议问题