This repository was archived by the owner on May 29, 2019. It is now read-only.
This repository was archived by the owner on May 29, 2019. It is now read-only.
alert type interpolation forces alert type to be a string #2867
Closed
Description
Seems that #1460 broke a pattern I was using for "strongly" typed alert types.
Essentially, if the type
property of the alert is actually an object with toString
overridden to provide the actual type string, the alert directive no longer resolves it correctly, resulting in an alert with no alert type class set.
Repro at http://plnkr.co/edit/GpvAnJpTHLHvcW83novF?p=preview
The repro also shows that manually using the same model property in a manually constructed alert (just using divs) works fine, it's the alert directive that can't use it.
Workaround for me for now is to change my binding to include the call to toString()
, e.g.:
<alert ng-show="viewModel.alert" type="{{ viewModel.alert.type.toString() }}" close="viewModel.clearAlert()">
{{ viewModel.alert.message }}
</alert>