Reputation: 1031
I have a ViewBag in my MVC Controller
ViewBag.total = true;
and I want to check it in my razor view with angular code and then to display or hide a div
<div ng-show="list" class="divList">
content here
</div>
Update
<div ng-show="'@(ViewBag.total)'">content</div>
I have try this too Angular ng If not working with razor syntax but it doesn't work for me. Any idea? Thank you
Upvotes: 0
Views: 1646
Reputation: 1031
I finally dropped the idea of viewbag and solved the problem like that
<div ng-hide="myarray[0].myfield == 0 ">Content</div>
maybe is useful for someone else
Upvotes: 0
Reputation: 32
@{
var total= (string) ViewBag.total;
}
<div ng-if="total== 'true'">
</div>
Updated : please Check this
@{
var total= (string) ViewBag.total;
}
<div ng-if="total">
</div>
use This
Upvotes: 0