title: AngularJs: set "ng-show" true/false between different controllers
body: <p>I am quite new to angularjs, The problem I am facing is as follows:</p>
  
  <p>I have a navbar. which is controlled by a controller "navController" and it has links to "#/login" and "#/userregister". My nav bar is static. 
  my ui-view directives are below my nav bar: as shown</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;nav ng-controller='navController'&gt;
      &lt;a class="navbar-brand" href="/"&gt;First Angular Site&lt;/a&gt;
      &lt;a  class='label' href='#/userregister' ng-show="true" &gt;Click Here to Register&lt;/a&gt;
      &lt;a   class='label 'href ='#/login' ng-show="true"&gt;Click Here To Login&lt;/a&gt;
   &lt;/nav&gt;
  
  &lt;ui-view&gt;
    
  &lt;/ui-view&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I want to hide these two links when my state changes i.e when I'm in logged in. </p>
  
  <p>I can't figure how to hide them...as my controllers are different and my nav bar is static.  </p>
  
  <p>Possible Brain Storm Solution I thought would work. </p>
  
  <p>1) Use a function in my ng-show="somefunction()" to set it true and false. 
  To share data between controllers I used factory, but since factory is only initiated once. I had to drop this idea. </p>
  
  <p>2) Use Reslove of UI-Router to set a variable True or False. 
  But since my nav bar is not included in the (ui-view) directive. I have to drop this idea. </p>
  
  <p>Is there any more way in which I can do what i want to do. (i.e hide the two links after my state change ) </p>
  
  <p>EDIT: </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>app.controller ('simpleController',function($scope ,$http, $location, tokenfactory,loginusercheck, usernamefactory){
  //various stuff
  
  }
  
                  
                  </code></pre>
  </div>
  </div>
  </p>
  
  <p>This goes in my ui-view directives.</p>
  
  <p>and this is my navbar Controller.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>app.controller ('navController',function($scope,$location,tokenfactory,loginusercheck,usernamefactory ,$window){
    // sign out function defined only here
    }</code></pre>
  </div>
  </div>
  </p>
  
  <p>here is my .config </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>app.config (function ($stateProvider,$urlRouterProvider){
      $stateProvider
        .state('hello',
        {
          url: '/userregister',
          templateUrl: 'partials/view.html',
          controller: 'simpleController',
        })
        .state('listview',
          {
              url:'/list',
              templateUrl:'partials/list.html',
              controller:'newController'
             
              
          })
        .state('login',
          {
              url:'/login',
              templateUrl:'partials/login.html',
              controller: 'simpleController',
             
        })
        .state('index',{
              url:'/',
              templeUrl:'basic.html',
              controller:'simpleController'
          
          
        })
          .state('home',{
              url:'/home',
              templateUrl:'/partials/home.html',
              controller:'simpleController',
  
         }
              
              })
        $urlRouterProvider.otherwise('/')
      });</code></pre>
  </div>
  </div>
  </p>
  
  <p>I just need to hide those two links somehow. I dont think controller code is required, but still i'm posting. </p>