title: How to call a rootscope fuction in html - Angular Js
body: <p>i have made a <code>rootscope</code> function in which I am actually logging out the user. But I dont know how to call it in a view . </p>
  
  <p>My functions is</p>
  
  <pre><code>    $rootScope.logout = function () {
              $cookies.remove('auth_token');
              $cookies.remove('role');
              $cookies.remove('status');
              $cookies.remove('id');
              $location.path('/signin');
  //            window.alert("Logout Successfully");
              $rootScope.auth_token = $cookies.get('auth_token');
              $rootScope.role = $cookies.get('role');
              $rootScope.status = $cookies.get('status');
              $rootScope.id = $cookies.get('id');
              $rootScope.keyword_auth_token = 'Bearer ' + $rootScope.auth_token; //Need to store all of them 
  
              $rootScope.is_loggedin = false;
          };
  </code></pre>
  
  <p>My view is</p>
  
  <pre><code>&lt;button ng-click="$root.logout()"&gt;Logout&lt;/button&gt;
  </code></pre>
  
  <p>I have tried <code>$root.logout()</code>, <code>$rootScope.logout()</code> but its not working.</p>