http://play.ionic.io/app/81ff26fc9a28NG-模型不BTW工作2个指令(离子)
<body ng-app="app">
<ion-pane ng-controller="myCtrl">
<ion-header-bar class="bar-stable">
</ion-header-bar>
<ion-content class="padding">
<input ng-model="myInput" style="border:1px solid #ddd;width:100%;padding:5px" type="text" placeholder="search"/>
<br>
<br>
<br>
<br>
<br>
<ion-footer-bar ng-show="!loading" align-title="center">
<div class="padding" style="position:absolute;bottom:0;width:100%">
<button ng-click="search(myInput)" class="button button-block button-positive footer-btn" type="submit">able to get myInput value if put within ion-content</button>
</div>
</ion-footer-bar>
</ion-content>
<ion-footer-bar ng-show="!loading" align-title="center">
<div class="padding" style="position:absolute;bottom:0;width:100%">
<button ng-click="search(myInput)" class="button button-block button-positive footer-btn" type="submit">cannot get myInput value here</button>
</div>
</ion-footer-bar>
</ion-pane>
</body>
如何解决这个问题呢?为了样式的缘故,我必须将点击事件和输入字段放在两个不同的指令中,但是这导致了我无法获得ng-model的价值的问题。
邮政相关的代码,不只是给一个链接到另一个网站。 – Yatrix
@Yatrix ok更新了我的问题 –