title: AngularJS Simple conditions in the Controller
body: <p>I'm implementing notifications feature. In the service, i would GET request a URL that returns an array of notifications.</p>
  
  <p>In the controller i would have to set a variable that stores a message string for each notification type. I'm very new to angular and Just wanted to know if my syntax and logic is correct. </p>
  
  <pre><code>/* Model + Controller */
  // Assume wrapped in controller function
  
  $scope.notifications = notifications=[
  {id:1, type: 6},
  {id:2, type: 3},
  {id:3, type:4}]; 
  
  $scope.display_message = function(){
  
      if ($scope.notifications.type == 1){
  
      $scope.notification_message = "some text";
  
      } else if ($scope.notifications.type == 2){
  
      $scope.notification_message = "some text";
  
      }
  
    //... for brevity
  
  return $scope.notification_message
  
  }
  
  
  /* View */
  
  &lt;li ng-repeat={{notification in notifications}}&gt;
  
      {{display_message()}}
  &lt;/li&gt;
  </code></pre>