Bootstrap theme
Selected: {{ctrl.address.selected.formatted_address}}
{{$select.selected.formatted_address}}
Над этим элементом должно отображаться раскрывающееся меню выбора.
app.controller('DemoCtrl', function ($scope, $http, $timeout, $interval) {
var vm = this;
vm.address = {};
vm.refreshAddresses = function(address) {
var params = {address: address, sensor: false};
return $http.get(
'http://maps.googleapis.com/maps/api/geocode/json',
{params: params}
).then(function(response) {
vm.addresses = response.data.results;
});
};
}
{{:angular:angularjs:сторонние_модули:ui.select2:us.select2.png?600 |}}
====Select2 theme====
Select2 theme
Selected: {{ctrl.person.selected}}
{{$select.selected.name}}
email: {{person.email}}
age:
The select dropdown menu should be displayed above this element.
/**
* Фильтр по умолчанию AngularJS со следующим выражением:
* "person in people | filter: {name: $select.search, age: $select.search}"
* Используется оператор AND между 'name: $select.search' and 'age: $select.search'.
* Мы хотим использовать оператор OR.
*/
app.filter('propsFilter', function() {
return function(items, props) {
var out = [];
if (angular.isArray(items)) {
var keys = Object.keys(props);
items.forEach(function(item) {
var itemMatches = false;
for (var i = 0; i < keys.length; i++) {
var prop = keys[i];
var text = props[prop].toLowerCase();
if (item[prop].toString().toLowerCase().indexOf(text) !== -1) {
itemMatches = true;
break;
}
}
if (itemMatches) {
out.push(item);
}
});
} else {
// Let the output be the input untouched
out = items;
}
return out;
};
});
app.controller('DemoCtrl', function ($scope, $http, $timeout, $interval) {
var vm = this;
vm.people = [
{ name: 'Adam', email: 'adam@email.com', age: 12, country: 'United States' },
{ name: 'Amalie', email: 'amalie@email.com', age: 12, country: 'Argentina' },
{ name: 'Estefanía', email: 'estefania@email.com', age: 21, country: 'Argentina' },
{ name: 'Adrian', email: 'adrian@email.com', age: 21, country: 'Ecuador' },
{ name: 'Wladimir', email: 'wladimir@email.com', age: 30, country: 'Ecuador' },
{ name: 'Samantha', email: 'samantha@email.com', age: 30, country: 'United States' },
{ name: 'Nicole', email: 'nicole@email.com', age: 43, country: 'Colombia' },
{ name: 'Natasha', email: 'natasha@email.com', age: 54, country: 'Ecuador' },
{ name: 'Michael', email: 'michael@email.com', age: 15, country: 'Colombia' },
{ name: 'Nicolás', email: 'nicolas@email.com', age: 43, country: 'Colombia' }
];
}
{{ :angular:angularjs:сторонние_модули:ui.select2:us.select2_2.png |}}