Created
January 5, 2023 13:04
-
-
Save deviationist/6730a17efeb51f0fdd52e8293f79b1f9 to your computer and use it in GitHub Desktop.
How to print an attribute as a variable in a CSHTML-file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var ariaCurrent = true ? "aria-current=\"page\"" : ""; | |
| <a href="https://foo.bar" @Html.Raw(ariaCurrent)>Foo</a> | |
| var ariaCurrent2 = true ? @"aria-current=""page""" : ""; | |
| <a href="https://foo.bar" @Html.Raw(ariaCurrent2)>Foo</a> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment