0

I want to set ng-required to the razor model variable value but it does not work.

It works fine for setting classes but I am not using the angularjs attribute. It works with class but not ng-class:

ng-required="@(Model.IsNotesRequired)"

Is it possible to use razor variables with angularjs?

1 Answer 1

1

Yes you can combine angularjs with razor. Try this:

ng-required="@Model.IsNotesRequired.ToString().ToLower()"
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the response Bill P. That did it.

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.