更新时间:2023-01-05 18:32:47
您需要使用点符号。由于继承,简单值不会进行双向绑定。
You need to be using "dot notation". Because of inheritance, simple values will not do two way binding.
请使用以下代码进行与离子的双向数据绑定
Please use the following code for two way data binding with ionic
在控制器中
$scope.test={keyWord : ""};
在视图中
<div class="bar bar-header item-input-inset">
<label class="item-input-wrapper">
<i class="icon ion-search placeholder-icon"></i>
<input type="search" placeholder="Key Word" ng-model="test.keyWord">
</label>
<button ng-click="findPersons()" class="button button-bar-inline">Load</button>
</div>
Live Example are here & same issue are here.
从此处了解更多详情。
希望这有帮助!