I have a Html page with a text box and am using a bit of AngularJS to display the count of characters remaining -
<div ng-app="" class="container-fluid">
<form class="form" role="form">
<div class="form-group">
@Html.TextArea("Description", htmlAttributes: new { @class = "form-control", placeholder = "Description, ng_model = "descMessage" })
<div>
<label>{{ 500 - descMessage.length }}</label>
</div>
</div>
</form>
</div>
This works fine when I am simply displaying it as a partial view. I get correct count of chars remaining.
@Html.Partial("~/Views/Desc/Index.cshtml")
But does not work when I display it via JQuery. Instead of chars remaining, it always displays the actual text as - {{ 500 - descMessage.length }}
.
var options = {
url: "/Desc/Index",
type: "get",
dataType: "html"
};
$.ajax(options).done(function (data) {
var $target = $("#displayform");
$target.html(data);
});
The AngularJS expression was supposed to be evaluated here. Why does this not happen? I have used JQuery a lot in my experience, but first time using AngularJS along with it. How can I go about fixing this?