0

How to printout to html(angularjs) 'name' string as loop in the following code?
When I printed overwrited scope array, more than one printed last string.

var createMarker = function (place) {
var request = {
  reference: place.reference
};
var detail = new google.maps.places.PlacesService($scope.map.control.getGMap());
detail.getDetails(request, function(result, status) {
  if (status == google.maps.places.PlacesServiceStatus.OK) {
    $scope.map.markers.push({
      latitude: place.geometry.location.lat(),
      longitude: place.geometry.location.lng(),
      showWindow: false,
      name: result.name,
      phone: result.formatted_phone_number,
      website: result.website,
      html: result.html_attributions[0],
      type: result.types.toString()
    });
    $scope.$apply();


    $ionicLoading.hide();

  }

});

Thanks.

4
  • Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking.
    – Fizzix
    Commented May 17, 2016 at 0:40
  • So what do you need? Its not clear at all. Commented May 17, 2016 at 6:46
  • i want print this "name: result.name," as scope string. sample: <ul> <li ng-repeat="m in map.markers">{{$scope}}</li> </ul> @Fizzix
    – hicaz
    Commented May 17, 2016 at 7:11
  • i want print this "name: result.name," as scope string. sample: <ul> <li ng-repeat="m in map.markers">{{$scope}}</li> </ul> @mJunaidSalaat
    – hicaz
    Commented May 17, 2016 at 7:12

1 Answer 1

1

You don't have to write scope in your template, you can have your name string in the repeat just by using

<ul> 
  <li ng-repeat="m in map.markers">
    {{m.name}}
  </li>
</ul>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.