基本上我需要// Ionic Starter App
angular.module('myapp', ['ionic', 'myapp.controllers', 'myapp.services', 'myapp.directives'])
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if (window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
});
})
.config(function($stateProvider, $urlRouterProvider, $httpProvider) {
// Ionic uses AngularUI Router which uses the concept of states
// Learn more here: https://github.com/angular-ui/ui-router
// Set up the various states which the app can be in.
// Each state's controller can be found in controllers.js
// $httpProvider.defaults.useXDomain = true;
$stateProvider
//Page1
.state('page1', {
url: "/page1",
templateUrl: "templates/page1.html",
controller: "Page1Controller"
})
//Page2
.state('page2', {
url: "/page2",
templateUrl: "templates/page2.html",
controller: "Page2Controller",
})
// if none of the above states are matched, use this as the fallback
$urlRouterProvider.otherwise('/page1');
});
的帮助。现在我有一个搜索框,头上有这个JQuery代码。当我预览它时,也没有占位符。
select2
这是一张图片:
所以我想知道如何隐藏搜索?我对JQuery没有任何经验,所以请帮助我们。 感谢您抽出宝贵时间阅读!
这是我的html:http://pastebin.com/P8in7ASX
答案 0 :(得分:1)
您可以通过设置minimumResultsForSearch来隐藏搜索:
$(document).ready(function() {
$('select').select2({
placeholder: "Select a Townhall Level",
minimumResultsForSearch: Infinity,
allowClear: true
});
});
如果您有一个空选项作为选择中的第一个选项,则可以显示占位符:
<select>
<option></option>
... other options ...
</select>
如果您希望定位特定选择而不是所有选择,并且能够为每个选择应用不同的属性,请更改为:
$(document).ready(function() {
$('#targetElement1').select2({
... the properties you want applied to targetElement1 ...
});
$('#targetElement2').select2({
... the properties you want applied to targetElement2 ...
});
});
并提供您的选择ID:
<select id="targetElement1">
<option></option>
... other options ...
</select>
<select id="targetElement2">
<option></option>
... other options ...
</select>