1

How can I give my TextBox, ng-click attribute when using Html.TextBoxFor?

@Html.TextBoxFor(model => model.User.Firstname, 
new { 
    @class = "form-control required", 
    placeholder = "نام" 
})

1 Answer 1

3

Add ng_click to htmlAttributes object.

@Html.TextBoxFor(model => model.User.Firstname, new 
{ 
  @class = "form-control required", 
  placeholder = "نام" , 
  ng_click = "yourFunc()" 
})

*Note : The _ instead of - in ng_click is because C# does not accept -

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

Comments

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.