0
votes

I want to observe a property of a controller in a different controller, how can I achieve this?

App.ApplicationController=Ember.Controller.extend({
    isLoading:false
});
App.MypageController=Ember.Controller.extend({
    isLoading:function(){
    //I want this property to observe the isLoading property in the Application controller 
    //so that I can show certain part of mypage template only when isLoading in application
    //controller is false
    }
});
1

1 Answers

0
votes

Can't test this right now, but you can give it a go

App.ApplicationController = Ember.Controller.extend({
    needs: ['page'],
    page: Ember.computed.alias("controllers.page")
    isLoading:function(){
        return page.get('isLoading');
    }
});

Although, thinking about it, this might block the application controller, don't know enough to be certain. And there might be a better way to to know if the controller has loaded.