Issue
I have a controller:
public ActionResult Edit(int id) {
ViewBag.IsComplete = false;
return View(dbContext.Users.Where(user => user.Id == id))
}
and the corresponding view:
@model User
@{
ViewBag.Title = "Edit User";
Layout = "~/Views/Shared/_PopupLayout.cshtml";
}
<p>@ViewBag.IsComplete</p>
<div ng-init="init(isComplete: @ViewBag.IsComplete)" />
The first instance of ViewBag.IsComplete (in the <p>
tag) emits the correct value. The second emits null. Can anyone tell me what is going on here and how to fix it so the second @ViewBag.IsComplete emits the same as the first?
Solution
Use @Html.Raw(ViewBag.IsComplete)
in your ng-init binding.
Answered By - Dandy
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.