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:
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 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 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..