这被认为很简单,我已经多次使用show / hide ... 2个小时之后没有...在浏览器上工作......它不适用于我正在测试的移动设备上。
<li class="item" style="text-align:center" ng-if="showBlist==0">
No bouncr's available
</li>
<li class="item" ng-repeat="data in bouncrList" ng-if="showBlist==1">
<a class="item item-avatar" href="#">
<img src="{{avatar}}">
<h2>{{data.name}}</h2>
<p>{{data.venue}}, {{data.address}}</p>
</a>
</li>
$ionicPlatform.ready(function() {
$scope.initMap = function() {
$scope.positions = [];
$ionicLoading.show({
template: 'Loading...'
});
navigator.geolocation.getCurrentPosition(function(position) {
var pos = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
map = new google.maps.Map(document.getElementById('map'), {
center: pos,
zoom: 12
});
infowindow = new google.maps.InfoWindow();
var service = new google.maps.places.PlacesService(map);
service.nearbySearch({
location: pos,
radius: 5000,
type: ['night_club'],
}, callback);
function callback(results, status) {
if (status === google.maps.places.PlacesServiceStatus.OK) {
for (var i = 0; i < results.length; i++) {
createMarker(results[i]);
}
}
var locale = JSON.stringify(results[0].vicinity);
bouncrFactory.bouncrs(locale).then(function(data){
$scope.bouncrList = data.data.bouncrs
$rootScope.showBlist = data.data.showBlist
})
$rootScope.$apply()
}
function createMarker(place) {
var placeLoc = place.geometry.location;
var marker = new google.maps.Marker({
map: map,
position: place.geometry.location
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(place.name);
infowindow.open(map, this);
console.log(place.name)
});
}
$ionicLoading.hide();
})
}
$scope.initMap()
});
$ ionicPlatform.ready是从另一个解决方案中添加的 $ scope.apply是从另一个解决方案中添加的
我已经
了$timeout(function(){
...
},1000)
以及我能找到的其他解决方案