Ionic $scope中没有form对象
在ionic中 form需要定义在<ion-content>外面,否则在$scope中找不到form对象。
<ion-view >
<form name="loginForm" role="form">
<ion-content class="has-header has-footer">
<div class="list">
<div class="item item-borderless">
</div>
<div class="item item-input">
<label ng-class="{'has-error':loginForm.$submitted&&loginForm.userName.$invalid}">
<input type="text" name="userName" placeholder="姓名" ng-required>
</label>
</div>
<div class="item">
</div>
<div class="item item-borderless">
<button class="button button-block button-calm" ng-click="enter()">进入</button>
</div>
</div>
</ion-content>
</form>
</ion-view>
<form name="loginForm" role="form">
<ion-content class="has-header has-footer">
<div class="list">
<div class="item item-borderless">
</div>
<div class="item item-input">
<label ng-class="{'has-error':loginForm.$submitted&&loginForm.userName.$invalid}">
<input type="text" name="userName" placeholder="姓名" ng-required>
</label>
</div>
<div class="item">
</div>
<div class="item item-borderless">
<button class="button button-block button-calm" ng-click="enter()">进入</button>
</div>
</div>
</ion-content>
</form>
</ion-view>
相关推荐
Qc 2020-07-19
swiftwwj 2020-07-05
wcqwcq 2020-07-04
TONIYH 2020-06-11
yhginny 2020-04-20
nicepainkiller 2020-05-12
苦咖啡flask 2020-05-09
xinjing0 2020-05-08
Lius 2020-05-05
ajaxtony 2020-05-04
bcbeer 2020-04-23
sicceer 2020-04-20
cmsmdn 2020-02-18
longshengguoji 2020-02-13
ajaxtony 2020-02-03
ELEMENTS爱乐小超 2020-01-17
waterv 2020-01-01