Angular UI Router - Views in an Inherited State

前端 未结 4 1137
误落风尘
误落风尘 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 07:51

    This works for me.

    $stateProvider
        .state('base', {
          abstract: true,
          url:'/',
          templateUrl: 'views/base.html'
        })
        .state('base.home', {
          url: "",
          views: {
          "search@base": {
            templateUrl: "views/searchOfHome.html"
          }
          //content@base, contentOfHome.html
        }
        })
        .state('base.page2', {
          url: "page2",
          views: {
          "search@base": {
            templateUrl: "views/searchOfPage2.html"
          }
          //content@base, contentOfPage2.html
        });
    

    If 'base' is the root state, you don't need the '@base'

提交回复
热议问题