I am using Angular Js with Razor.
@{
var pageMode = (string) ViewBag.PageMode;
}
<div ng-if="@pageMode == 'answer'">
<h2>Greetings</h2>
</div>
Value is in ViewBag.PageMode
is "answer", still the ng if does not render. i.e "Greetings" message does not work.
What am I doing wrong here... ?
you cant use
var pageMode
variable inside directives likeng-if
. you need to use$scope
variable.so, simplest thing u can do is,