0

I am new to MVC and using MVC5 along with angular-material. I want to implement MVC model variable with angular material checkbox (md-checkbox) .

This is my md-checkbox implementation .

<md-checkbox ng-model="user.rememberMe" aria-label="Remember Me">
  Remember Me
</md-checkbox>

and want to implement Model variable RememberMe as like this in my view .

<div class="checkbox">
  @Html.CheckBoxFor(m => m.RememberMe)
  @Html.LabelFor(m => m.RememberMe)
</div>

How can i do that ?

1 Answer 1

0

you can always use attributes:

m=>m.RememberMe, new { "ng-model"="user.rememberMe" }

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

2 Comments

I think that will create a simple plain checkbox not md-checkbox (angular checkbox ) .
Sure it can work too. but some situations you d need use same helper multiple place for this sit. using helper helps to make changes in one place like componentize.. Otherwise absolutely i agree. On new version MVC 6 , they are using tag attributes again like old days. regards.

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.