Mathias Kozlowski
Mathias Kozlowski

Reputation: 93

MVC Razor context commutation problem

I'm trying to output a "x3" string with value stored in my model.

<span>[email protected]</span> output => [email protected]

doesn't switch correctly to code after @.

The following works correctly:

<span>*@Model.Quantity</span> => *3 <span>x @Model.Quantity</span> => x 3 (but I don't want the space of course)

My actual fix:

<span>@{<text>x</text>}@Model.Quantity</span> => x3

Does the @ commutator needs to follow a word boundary? Is it a bug of the parser? (my actual testing machine: MVC3 RC2)

Thx

Upvotes: 2

Views: 224

Answers (1)

Mikael Eliasson
Mikael Eliasson

Reputation: 5227

[email protected] could be a email address so I think the parser consider that as text. It works if you do:

<span>x@(Model.Quantity)</span>

Upvotes: 6

Related Questions