离子显示与按钮操作选项中进行选择 [英] Ionic show select with options on button action
问题描述
我要显示选项,同时pressing按钮不显示下拉框。对于选择的参考。但是,当我尝试实施它给了我下拉框。我不想表现出来。我想显示的选项。
I want to show options while pressing the button not to show dropdown box. For the reference of select. But when I try to implement it gives me dropdown box. I don't want to show it. I want to show options.
推荐答案
这是我根据你要求的工作,请看看:
1.In您的index.html一个方法添加一个按钮
Hi This is worked for me based upon your requirement, Please have a look:
1.In your index.html add a button with a method as
<ion-content ng-controller="ExampleCtrl">
<button class="button button-bar button-positive" ng-click="showSelect()">Options</button>
</ion-content>
2.In您的app.js文件写控制器code。与功能:
2.In your app.js file write the controller code with function as:
.controller('ExampleCtrl', ['$scope', '$ionicPopup',function($scope,$ionicPopup) {
$scope.values=['1','2','3','4'];
$scope.showSelect = function(){
$ionicPopup.alert({
title:'select an option',
templateUrl:'test.html'
});
}
}])
3.last最后一步创建一个的test.html
文件在您的项目并粘贴code为:
3.last and final step create a test.html
file in your project and paste the code as:
<ion-view view-title="select">
<ion-content ng-controller="ExampleCtrl">
<ion-list ng-repeat="item in values">
<ion-item>
{{item}}
</ion-item>
</ion-list>
</ion-content>
</ion-view>
有任何疑问,请回复。
Having any queries,Please reply..
这篇关于离子显示与按钮操作选项中进行选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!