title: Angular switch when not working
body: <p>I am trying to make a simple <strong>switch when</strong> statement in my Angular template and the switch statement output must be "<strong>You're a user</strong>" but it says that I am a guest.</p>
  
  <p>What is wrong with my code?</p>
  
  <pre><code>&lt;p&gt;&lt;strong&gt;Current role&lt;/strong&gt;&lt;/p&gt;
  &lt;p&gt;{{ app.currentUser.role }}&lt;/p&gt;
  &lt;p&gt;&lt;strong&gt;Role to compare with&lt;/strong&gt;&lt;/p&gt;
  &lt;p&gt;{{ app.userRoles.user }}&lt;/p&gt;
  </code></pre>
  
  <p><strong>output:</strong></p>
  
  <pre><code>Current role
  user
  
  Role to compare with
  user
  </code></pre>
  
  <h1>Switch statement</h1>
  
  <pre><code>&lt;div ng-switch on="app.currentUser.role"&gt;
    &lt;div ng-switch-when="app.userRoles.admin"&gt;You're admin.&lt;/div&gt;
    &lt;div ng-switch-when="app.userRoles.moderator"&gt;You're moderator.&lt;/div&gt;
    &lt;div ng-switch-when="app.userRoles.user"&gt;You're a user.&lt;/div&gt;
    &lt;div ng-switch-default&gt;You're a guest.&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>output:</strong></p>
  
  <pre><code>You're a guest.
  </code></pre>
  
  <p><strong>Angular controller:</strong></p>
  
  <pre><code>function MainController() {
      my = this;
  
      my.currentUser = { role : 'user'};
      my.userRoles = { user : 'user' };
  
    }
  </code></pre>
  
  <p><strong>Plunker link:</strong>
  <a href="https://plnkr.co/edit/oCKVTjfTwkwYO9UVQU6X?p=preview" rel="nofollow noreferrer">https://plnkr.co/edit/oCKVTjfTwkwYO9UVQU6X?p=preview</a></p>