1

I need to replace the following helper with its corresponding HTML in a view:

@Html.HelperTextBoxFor(model => model.Length, new { @ng_change = "changeArea()" })

I came up with this:

<input type="text" data-ng-model="MyViewModel.Length" class="form-control" />

But I cannot find where to add the new { @ng_change = "changeArea()"}

Can anyone help me please?

1
  • Cant you just do the same using Jquery/JavaScript? Commented Oct 22, 2015 at 7:48

2 Answers 2

2

If this @ng_change="..." is an Angular directive, this would look like this in an input tag:

<input type="text" data-ng-model="MyViewModel.Length" class="form-control" ng-change="changeArea()"/>

reference: https://docs.angularjs.org/api/ng/directive/ngChange

Sign up to request clarification or add additional context in comments.

Comments

0

You need to get back to the basics here, not sure why you can't figure it out.

http://www.w3schools.com/jsref/event_onchange.asp

<input type="text" data-ng-model="MyViewModel.Length" class="form-control" onchange="changeArea();" />

2 Comments

Thanks! Because I am a beginner!
No problem, you jump in the deep end here!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.