Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

fix(alert): correct binding of alert type class #2146

Closed
wants to merge 1 commit into from

Conversation

chrisirhc
Copy link
Contributor

Regression from #1745 as there's a double interpolation expected but
ngClass doesn't support that.

The attribute value of ngClass is only interpolated once and the
interpolated expression is watched.

Fixes #2145

Regression from angular-ui#1745 as there's a double interpolation expected but
ngClass doesn't support that.

The attribute value of ngClass is only interpolated once and the
interpolated expression is watched.

Fixes angular-ui#2145
@@ -1,4 +1,4 @@
<div class="alert" ng-class="{'alert-{{type || 'warning'}}': true, 'alert-dismissable': closeable}" role="alert">
<div class="alert" ng-class="'alert-' + (type || 'warning') + (closeable ? ' alert-dismissable' : '')" role="alert">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chrisirhc It would be more readable to use the array syntax, like this:

ng-class="['alert-' + (type || 'warning'), closeable ? 'alert-dismissable' : null]"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed, provided that it works :-)

@chrisirhc chrisirhc closed this in aa188ae May 5, 2014
@pkozlowski-opensource
Copy link
Member

Changed it as suggested by @bekos and landed, thnx @chrisirhc !

@chrisirhc chrisirhc deleted the feature/fix-2145 branch May 16, 2014 03:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Alert type expressions are ignored when applied in an event method (always shows warning-style)
3 participants