我新的Angularjs,下面是我的代碼,有毛病我AngularJs代碼
<!DOCTYPE html>
<html>
<head>
<title>ng-Messages Service</title>
<script src='https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script>
<script src='https://code.angularjs.org/1.5.0-rc.0/angular.min.js'></script>
<script src='https://code.angularjs.org/1.5.0-rc.0/angular-messages.min.js'></script>
<script src="ng-messages.js"></script>
</head>
<body>
<div ng-controller='thecontroller'>
<form name="myForm">
<label>
Enter text:
<input type="text" ng-model="field" name="myField" required minlength="5" />
</label>
<div ng-messages="myForm.myField.$error" role="alert">
<div ng-message="required">You did not enter a field</div>
<div ng-message="minlength, maxlength">
Your email must be between 5 and 100 characters long
</div>
</div>
</form>
</div>
</body>
</html>
及以下angularjs代碼,
var myApp=angular.module('myApp',['ngMessages']);
myApp.controller('thecontroller',function($scope){
$scope.name="Gopal";
});
我們沒有得到正確的輸出,什麼是錯的用我的上面的代碼。
感謝
你所期望的輸出? –
什麼是「正確的輸出」?你有錯誤嗎?如果是這樣,哪些錯誤? –
請確保您的問題具有所需的所有信息,以幫助您的人在這裏: https://stackoverflow.com/help/mcve 或者您的問題將在任何時候關閉。 –