Custom dropdown with angular js
up vote
0
down vote
favorite
I created an address search input. When user enter a location to input ajax request is working. $scope.resultLocation is storing data. I want to show #resultLocation when user focus on #searchLocation. Ng-focus is working but when I want to click to ul list is hiding. I can't click a tag. What is alternative method? How can I solve this problem?
HTML
<div class="collapse show multi-collapse w-100" id="multiCollapseExample1" data-parent="#tabs">
<div class="itemContainer">
<input type="text" autofocus maxlength="60" id="locationSearch" data-ng-focus="resultLocationStatus=true;" data-ng-blur="resulLocationStatus=false;" data-ng-keyup="findLocation();" data-ng-model="locationSearch" class="locationSearch" placeholder="search">
<button class="icon-search btn btn-color3"></button>
</div>
<div class="col-12" id="resultLocation" data-ng-if="resultLocation && resultLocationStatus==true" style="position: absolute; z-index: 986; top: 100%; left: 0; right: 0;">
<ul class="list-group scrollbar" style="max-height:300px;">
<li class="list-group-item" ng-repeat=" opt in resultLocation">
<a class="d-block cpointer" href="{{parseLocation(opt.GeoObject.Point.pos.toString())}}"><span class="icon-map-location-6"> </span>{{ opt.GeoObject.metaDataProperty.GeocoderMetaData.text}}</a>
</li>
</ul>
</div>
</div>
JS
$scope.findLocation = function () {
$.ajax({
type: 'get',
url: "https://geocode-maps.yandex.ru/1.x/?&bbox=24.125977,34.452218~45.109863,42.601620&results=5&format=json&lang=tr_TR&geocode=" + $scope.locationSearch,
dataType: 'json',
success: function (data) {
$scope.resultLocation = data.response.GeoObjectCollection.featureMember; }
},
error: function (data) {}
});
}
angularjs
add a comment |
up vote
0
down vote
favorite
I created an address search input. When user enter a location to input ajax request is working. $scope.resultLocation is storing data. I want to show #resultLocation when user focus on #searchLocation. Ng-focus is working but when I want to click to ul list is hiding. I can't click a tag. What is alternative method? How can I solve this problem?
HTML
<div class="collapse show multi-collapse w-100" id="multiCollapseExample1" data-parent="#tabs">
<div class="itemContainer">
<input type="text" autofocus maxlength="60" id="locationSearch" data-ng-focus="resultLocationStatus=true;" data-ng-blur="resulLocationStatus=false;" data-ng-keyup="findLocation();" data-ng-model="locationSearch" class="locationSearch" placeholder="search">
<button class="icon-search btn btn-color3"></button>
</div>
<div class="col-12" id="resultLocation" data-ng-if="resultLocation && resultLocationStatus==true" style="position: absolute; z-index: 986; top: 100%; left: 0; right: 0;">
<ul class="list-group scrollbar" style="max-height:300px;">
<li class="list-group-item" ng-repeat=" opt in resultLocation">
<a class="d-block cpointer" href="{{parseLocation(opt.GeoObject.Point.pos.toString())}}"><span class="icon-map-location-6"> </span>{{ opt.GeoObject.metaDataProperty.GeocoderMetaData.text}}</a>
</li>
</ul>
</div>
</div>
JS
$scope.findLocation = function () {
$.ajax({
type: 'get',
url: "https://geocode-maps.yandex.ru/1.x/?&bbox=24.125977,34.452218~45.109863,42.601620&results=5&format=json&lang=tr_TR&geocode=" + $scope.locationSearch,
dataType: 'json',
success: function (data) {
$scope.resultLocation = data.response.GeoObjectCollection.featureMember; }
},
error: function (data) {}
});
}
angularjs
maybe irrelevant, but you should be using$httpservice instead of jQuery AJAX. e.g.$http.get(url).then(function(res){ $scope.resultLocation = res.data.response... })
– Aleksey Solovey
Nov 21 at 9:35
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I created an address search input. When user enter a location to input ajax request is working. $scope.resultLocation is storing data. I want to show #resultLocation when user focus on #searchLocation. Ng-focus is working but when I want to click to ul list is hiding. I can't click a tag. What is alternative method? How can I solve this problem?
HTML
<div class="collapse show multi-collapse w-100" id="multiCollapseExample1" data-parent="#tabs">
<div class="itemContainer">
<input type="text" autofocus maxlength="60" id="locationSearch" data-ng-focus="resultLocationStatus=true;" data-ng-blur="resulLocationStatus=false;" data-ng-keyup="findLocation();" data-ng-model="locationSearch" class="locationSearch" placeholder="search">
<button class="icon-search btn btn-color3"></button>
</div>
<div class="col-12" id="resultLocation" data-ng-if="resultLocation && resultLocationStatus==true" style="position: absolute; z-index: 986; top: 100%; left: 0; right: 0;">
<ul class="list-group scrollbar" style="max-height:300px;">
<li class="list-group-item" ng-repeat=" opt in resultLocation">
<a class="d-block cpointer" href="{{parseLocation(opt.GeoObject.Point.pos.toString())}}"><span class="icon-map-location-6"> </span>{{ opt.GeoObject.metaDataProperty.GeocoderMetaData.text}}</a>
</li>
</ul>
</div>
</div>
JS
$scope.findLocation = function () {
$.ajax({
type: 'get',
url: "https://geocode-maps.yandex.ru/1.x/?&bbox=24.125977,34.452218~45.109863,42.601620&results=5&format=json&lang=tr_TR&geocode=" + $scope.locationSearch,
dataType: 'json',
success: function (data) {
$scope.resultLocation = data.response.GeoObjectCollection.featureMember; }
},
error: function (data) {}
});
}
angularjs
I created an address search input. When user enter a location to input ajax request is working. $scope.resultLocation is storing data. I want to show #resultLocation when user focus on #searchLocation. Ng-focus is working but when I want to click to ul list is hiding. I can't click a tag. What is alternative method? How can I solve this problem?
HTML
<div class="collapse show multi-collapse w-100" id="multiCollapseExample1" data-parent="#tabs">
<div class="itemContainer">
<input type="text" autofocus maxlength="60" id="locationSearch" data-ng-focus="resultLocationStatus=true;" data-ng-blur="resulLocationStatus=false;" data-ng-keyup="findLocation();" data-ng-model="locationSearch" class="locationSearch" placeholder="search">
<button class="icon-search btn btn-color3"></button>
</div>
<div class="col-12" id="resultLocation" data-ng-if="resultLocation && resultLocationStatus==true" style="position: absolute; z-index: 986; top: 100%; left: 0; right: 0;">
<ul class="list-group scrollbar" style="max-height:300px;">
<li class="list-group-item" ng-repeat=" opt in resultLocation">
<a class="d-block cpointer" href="{{parseLocation(opt.GeoObject.Point.pos.toString())}}"><span class="icon-map-location-6"> </span>{{ opt.GeoObject.metaDataProperty.GeocoderMetaData.text}}</a>
</li>
</ul>
</div>
</div>
JS
$scope.findLocation = function () {
$.ajax({
type: 'get',
url: "https://geocode-maps.yandex.ru/1.x/?&bbox=24.125977,34.452218~45.109863,42.601620&results=5&format=json&lang=tr_TR&geocode=" + $scope.locationSearch,
dataType: 'json',
success: function (data) {
$scope.resultLocation = data.response.GeoObjectCollection.featureMember; }
},
error: function (data) {}
});
}
angularjs
angularjs
asked Nov 21 at 8:32
Hermes
140113
140113
maybe irrelevant, but you should be using$httpservice instead of jQuery AJAX. e.g.$http.get(url).then(function(res){ $scope.resultLocation = res.data.response... })
– Aleksey Solovey
Nov 21 at 9:35
add a comment |
maybe irrelevant, but you should be using$httpservice instead of jQuery AJAX. e.g.$http.get(url).then(function(res){ $scope.resultLocation = res.data.response... })
– Aleksey Solovey
Nov 21 at 9:35
maybe irrelevant, but you should be using
$http service instead of jQuery AJAX. e.g. $http.get(url).then(function(res){ $scope.resultLocation = res.data.response... })– Aleksey Solovey
Nov 21 at 9:35
maybe irrelevant, but you should be using
$http service instead of jQuery AJAX. e.g. $http.get(url).then(function(res){ $scope.resultLocation = res.data.response... })– Aleksey Solovey
Nov 21 at 9:35
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53407982%2fcustom-dropdown-with-angular-js%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
maybe irrelevant, but you should be using
$httpservice instead of jQuery AJAX. e.g.$http.get(url).then(function(res){ $scope.resultLocation = res.data.response... })– Aleksey Solovey
Nov 21 at 9:35