第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

ng-if不起作用

<body>

<style>

* { margin: 0; padding: 0;}


.outDiv {

width:500px;

height:500px;

margin:50px auto;

font-family:"華文楷體";

font-size:25px;

}

p {

margin-left:100px;

}

.null {}

.error {

border:1px solid red;

}

.worry {

font-family:"黑體";

font-size:14px;

color:red;

margin-left:100px;

}

input {

width:300px;

height:30px;

margin:10px 0px 10px 100px;

}

.btn {

width:200px;

height:40px;

background-color:#0F0;

border:1px solid #0C0;

margin-left:160px;

}

</style>

<div class="outDiv" ng-controller="myCtrl">

? ? <form name="addForm" ng-submit="upform()">

? ? ? ? <h2 align="center">用戶注冊</h2><br />

? ? <div>

? ? ? ? ? ? <p>用戶名:</p><input type="text" placeholder="請輸入用戶名" ng-model="username" ng-minlength="4" ng-maxlength="10" required /><br />

? ? ? ? ? ? ? ? <div class="worry" ng-if="addForm.username.$invalid">您輸入有誤請檢查</div>

? ? ? ? ? ? </div>

? ? ? ? ? ? <div>

? ? ? ? ? ? <p>密碼:</p><input type="password" placeholder="請輸入密碼" ng-model="password" />

? ? ? ? ? ? </div>

? ? ? ? ? ? <div>

? ? ? ? ? ? <p>確認密碼:</p><input type="password" placeholder="請輸入確認密碼" ng-model="password2" />

? ? ? ? ? ? </div>

? ? ? ? ? ? <div><input type="submit" value="提交" class="btn" /></div>

? ? </form>

? ? </div> ? ?

<script src="js/angular-1.3.0/angular.min.js"></script>

<script>

? ? var app = angular.module('myApp',[]);

app.controller('myCtrl',function($scope){

$scope.upform = function(){

console.log('表單提交了!');

};

});

? ? </script>

</body>


正在回答

1 回答

你有2個錯誤:

1:你沒有在body加 ng-app="myApp" ;

2:<input type="text" placeholder="請輸入用戶名" ng-model="username" ng-minlength="4" ng-maxlength="10" required /> ?這個加上 name="username"

0 回復 有任何疑惑可以回復我~
#1

慕斯卡4094373 提問者

非常感謝!非常感謝你,幫我解決問題
2017-03-01 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
AngularJS表單驗證
  • 參與學習       39415    人
  • 解答問題       140    個

一看就明白的AngularJS表單驗證

進入課程

ng-if不起作用

我要回答 關注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號