ng-click内标不起作用

时间:2015-11-13 06:00:51

标签: ionic-framework ionic angularjs-ng-click



<ion-view>
	<div class="bar bar-header bar-dark">
		<h1 class="title">Welcome</h1>
	</div>
	<ion-content class="has-header">
		<form ng-submit="doLogin()">
			<div class="list">
				<label class="item item-input">
					<span class="input-label">手机号</span>
					<input type="text" ng-model="phonenumber" placeholder="这里输入手机号" maxlength="11">
					<button class="button button-dark" style="margin-right: 16px;" ng-click="getVerifyCode(111)">获取验证码</button>
				</label>
				<label class="item item-input">
					<span class="input-label">验证码</span>
					<input type="password" ng-model="verifycode">
				</label>
				<label class="item">
					<button class="button button-block button-dark" ng-click="getVerifyCode(111)">登 陆</button>
				</label>
			</div>
		</form>
	</ion-content>
</ion-view>
&#13;
&#13;
&#13;

  1. 为什么标签标签内的按钮(获取验证码)不起作用?

  2. 但是标签外面的按钮(登陆)工作正常,为什么?

  3. 请帮我解决这个问题。我需要在点击时做出回复 按钮(获取验证码)

1 个答案:

答案 0 :(得分:16)

working demo

解决方案就是不要对项目使用label。而只需使用div

html

<form ng-submit="doLogin()">
        <div class="list">
            <div class="item item-input">
                <span class="input-label">手机号</span>
                <input type="text" ng-model="phonenumber" placeholder="这里输入手机号" maxlength="11">
                <!-- <input ></input> -->
                <button class="button button-dark" style="margin-right: 16px;" ng-click="getVerifyCode(111)">获取验证码</button>
            </div>
            <label class="item item-input">
                <span class="input-label">验证码</span>
                <input type="password" ng-model="verifycode">
            </label>
            <label class="item">
                <button class="button button-block button-dark" ng-click="getVerifyCode(111)">登 陆</button>
            </label>
        </div>
</form>