1

I am using below code as a validation message. i am trying to hide my validation message if its success message. please check my code

    <div uib-alert ng-repeat="alert in alerts"  ng-class="'alert-' + (alert.type || 'info')" dismiss-on-timeout="{{alert.type == success ? '5000' : ''}}"
    close="alerts.splice(index, 1)">
   {{alert.msg}}

alert. type can be 'success or error'. i need to hide this only if, 'alert.type= success'. i tried. but not working. how i add condition. thanks

kumara
  • 877
  • 4
  • 19
  • 43

1 Answers1

1

You need to use the string success and 5000 as a number, also the else condition would be none instead of ''. Combining all these, you will need:

dismiss-on-timeout="{{ alert.type == 'success' ? 5000 : 'none' }}"

Plunkr example

Anurag Srivastava
  • 14,077
  • 4
  • 33
  • 43