0
這裏我使用angularJs,這裏怎麼專注於特定領域創建簡單的程序發生錯誤時提前 感謝AngularJs專注於特定領域
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.save=function(){
if($scope.firstName != undefined){
if($scope.firstName.length < 3) {
alert("Please Enter More that 3 char");
}
}
}
\t
\t
})
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<body ng-app="myApp" ng-controller="myCtrl">
<form>
<input type="text" ng-model="firstName"/>
<input type="submit" ng-click="save()"/>
</form>
</body>