0

I have something like

myApp.run(function ($rootScope, $window, $location) {
    $rootScope.empty_nav = function (showme) {
    $rootScope.msg_nav_planes=true;
    $rootScope.msg_nav_tusplanes=true;
    $rootScope.msg_nav_participantes=true;
    $rootScope.msg_nav_fotos=true;
    $rootScope.msg_nav_listas=true;
    $rootScope.msg_nav_back=true;
    $rootScope.msg_nav_plan=true;

    $rootScope.showme = '';   // this wont work :(
 };
});

Where that «true» hides the element. Those elements are navegation links in the header. I swap them depending on which page i am, calling empty_nav() from the corresponding controller. The problem is $rootScope. If i do a console.log() inside the function each item is getting the values correctly, including the selected one. But in the concrete cases (browsing each page), it only hides all the items, but afterwards the indicated item wont fade in.

am I doing something wrong?

PD: I'm thinking also in having only one item and pass to it the link and the text .... instead having so many items :/

leandro713
  • 1,268
  • 1
  • 10
  • 17
  • I don't really get a problem, creating a jsFiddle might help to clarify things. But in general, your set-up looks wrong to me. If you want to display different parts for different pages, you should take a look at routes in AngularJS. This looks like a unmaintainable mess... – dirkk Sep 24 '13 at 10:11
  • I agree. Using $rootScope not for event ($emit, $on) is often an alert. I advice you to read a little more about angularjs. http://egghead.io is great (50+ free videos) – Utopik Sep 24 '13 at 10:17

0 Answers0