Setting id

Mar 8, 2014 at 7:15 PM
Hi,
first of all: thanks for lib, really helpful!

Maybe I'm missing something, but I can't figure out how to set an id for a generated element. Being able to (optionally) set an id would be very useful to add/remove style class (like spin) on mouseover events or while processing some async operation.

It would be cool to set the id as an optional parameter like "settings_ico" in the following example:
@Html.FontAwesome(FontAwesomeIconSet.Cog,FontAwesomeStyles.Spin,"settings_ico")
Thanks for your consideration!
Markus
Coordinator
Mar 12, 2014 at 11:36 AM
In the currently published version you can do this with a few lines of code as shown below:
@{
    FontAwesomeIcon icon1 = (FontAwesomeIcon)FontAwesomeIconSet.Globe.Clone();
    icon1.Id = "12345";
    icon1.IncludeIdInHtml = true;
}

@icon1.Html
You must use the .Html to out the markup because the extension method will override the ID settings.

I will add an extension method so that it can be done inline using @Html ...
Mar 12, 2014 at 11:53 AM
Fine, thank you!