Javascript 角js或IONAL中的动态下拉列表
Javascript 角js或IONAL中的动态下拉列表,javascript,angularjs,html,ionic-framework,Javascript,Angularjs,Html,Ionic Framework,$scope.AllCities=window.localStorage.getItem['all_cities'] 选择子对象 请选择城市 动态类别列表显示 <div class="label_EventDetail" align="left">Category</div> <select class="ion-input-select" ng-options="category.name for category in
$scope.AllCities=window.localStorage.getItem['all_cities']代码>
选择子对象
请选择城市
动态类别列表显示
<div class="label_EventDetail" align="left">Category</div>
<select class="ion-input-select" ng-options="category.name for category in categorys" ng-model="selectedcategory" ng-change="callFunction(selectedcategory)">
<option value="">Select Category</option>
</select>
</div>
//调用方法是
$scope.callFunction = function(data) {
console.log(data);
//you selected any data from list show in console.
}
当我从列表中选择任何ng更改事件时,调用上述代码
ng-change="callFunction(selectedcategory)"
并且callFunction不是必需的(取决于使用情况)
您可以从selectedcategory变量中获取所选数据
ng-change="callFunction(selectedcategory)"