Skip to content

flash.to with dynamic ids #43

@spiermar

Description

@spiermar

I have something like this:

<div id="{{ 'alert-disklatency-error-' + id }}" flash-alert="error" active-class="in alert" class="fade">
    <strong class="alert-heading">Error!</strong>
    <span class="alert-message">{{flash.message}}</span>
</div>

Where the div id is being generated dynamically. The id variable is coming from a directive. Inspecting the element once the page is loaded, the element id is resolved correctly.

If I try this:

flash.to("alert-disklatency-error-" + String(id)).error = 'error!';

Nothing is displayed. Again, the id is being resolved correctly, and if I remove the id from the equation, the alert is displayed correctly.
Unfortunately, I need dynamically generated Ids, since I'll have objects being created dynamically.

Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions