Ngval
ASP.NET MVC validation for AngularJS
Install / Use
/learn @alisabzevari/NgvalREADME
ngval
ASP.NET MVC validation for AngularJS.
Getting Started
1.Add data anotations to your entities
public class TestEntity
{
[Required]
public string RequiredProperty { get; set; }
[StringLength(10)]
public string Length10Property { get; set; }
[Required]
[StringLength(10)]
public string MultipleValidationProperty { get; set; }
}
2.Reference ngval.js to your page
<script src="~/Scripts/ngval.js"></script>
3.Add ngval module to your app module dependencies
var App = angular.module('App', ['ngval']);
4.Use NgValFor Html helper method to insert angularjs directives for validation. It will also add native angularjs directives. And you can use ngval object for error messages and more.
<form name="testForm" novalidate ng-submit="submit()">
<input type="text" name="username" ng-model="user.name" @Html.NgValFor(u => u.RequiredProperty) />
{{testForm.username.ngval.hasError}}
<div ng-repeat="err in testForm.username.ngval.errors">
<span>{{err.message}}</span>
<br />
</div>
<input type="submit" />
</form>
Related Skills
node-connect
347.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
108.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
