0

I'm trying to display a Bootstrap alert by following the example in the documentation. This is my HTML:

<div class='container'>
  <div ng-init="alerts=[{type: 'danger', msg: 'Test'}, {type: 'success', msg: 'Another'}]">
    <alert close='closeAlert($index)' ng-repeat='alert in alerts' type='alert.type'></alert>

And this is the result: Red bar and green bar without text

The text is not showing and clicking on x does not remove the alert. I'm not seeing any Javascript errors. I'm able to use other ui.bootstrap components such as the date picker and modal.

I'm using AngularJS 1.2.13 and ui.bootstrap 0.10.0.

1
  • 1
    Can you post your JavaScript? Commented Mar 14, 2014 at 16:04

1 Answer 1

2

Text is not showing as the content of the <alert></alert> element is empty in the code you've provided. I guess you wanted to write:

<alert close='closeAlert($index)' ng-repeat='alert in alerts' type='alert.type'>
    {{alert.msg}}
</alert>

Then, for the close "not working" I suspect some scoping issue, but to confirm we would need to see implementation of the closeAlert function. Where / how did you define it?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.