Yoni Yaacov
Yoni Yaacov

Reputation: 1

AngularJS $stateProvider - change parent template view from child state

Hello everyone this is my first post in Stackoverflow! I am new to $stateProvider and trying to complete the following behavior: I am trying to modify and load a new state's parent view from its child state. There is the main view (parent) that has two views, a content view and a navigation menu view on the left hand side. There are multiple child states for a parent state and once the user goes to a child state I would like to load a different navigation menu that was initialized in the parent state.

.state("parent", {
            views: {
                'contentView': {
                    templateUrl: baseUrl + "home.html",
                    controller: "homeController"
                },
                'navBar': {
                    templateUrl: baseUrl + "navMenus/navMenu1.html",
                    controller: "navMenuController"
                }
            }            
        })

 .state("parent.child", {

    views: {
       'navBar': {
            templateUrl: baseUrl + "navMenus/navMenu2.html",
           controller: "navMenuController"
        }
    }

Upvotes: 0

Views: 249

Answers (1)

Alan haha
Alan haha

Reputation: 541

You can use Absolute Name. In your case, try navBar@parent.

Upvotes: 0

Related Questions