angularjs - ng-repeat and value of object -


i having problem these labels.

i have arrangement information, including longitude , latitude of markers within map. click on of them want show information each of these markers. problem not recognize values of arrangement.

my array :

$scope.views = [   {       id : 0,       nombre : 'problema con cableado',       fecha : '18/05/2014 las 15:17',       estado : 'en revisión',       latitud : -33.3995448,       longitud : -70.5705277,       img : 'img/cables.jpg',       comentario : 'exiten problemas en el cableado, estan sueltos y es peligroso. concurre mucha gente por ese lugar.',       : 1,       like_me : true,       icono : 'icon ion-android-favorite',        clase : 'label_estado label-warning'   },   {       id : 1,       nombre : 'poste en mal estado',       fecha : '09/11/2013 las 20:45',       estado : 'solucionado',       latitud : -33.4024754,       longitud : -70.5919616,       img : 'img/poste.jpeg',       comentario : 'el poste esta punto de caer, se encuentra en una calle muy concurrida por personas y automóviles.',       : 5,       like_me : true,       icono:'icon ion-android-favorite',        clase : 'label_estado label-success'   },   {       id : 2,       nombre : 'cañeria rota',       estado : 'falta información',       fecha : '03/03/2012 las 12:13',       latitud : -33.406975,       longitud : -70.57283,       img : 'img/caneria.jpg',       comentario : 'esta rota y oxidada, corre agua por todo el lugar.',       : 0,       like_me : false,       icono : 'icon ion-android-favorite-outline',        clase : 'label_estado label-info'    } ]; 

my html :

<ion-content class="map-container">       <map center="{{latitud}}, {{longitud}}" zoom="12" id="map_views" data-tap-disabled="true">           <div id="class"  data-tap-disabled="true" ng-repeat="view in views">               <marker position="{{view.latitud}}, {{view.longitud}}" on-click="verinfo({{view}})" data-tap-disabled="true"/>           </div>       </map> 

function :

$scope.verinfo = function(view){   $ionicpopup.show({      title: 'información view',      subtitle: '',      content: '<p>nombre : '+view.nombre+'</p><p>estado : '+view.estado+'</p><p>fecha : '+view.fecha+'</p><img src='+view.img+'>',      buttons: [                {                 text: 'ok',                 type: 'button-positive',                 ontap: function(e) {                  }               },             ]       })    } 

undefined receive data , not understand why.

** edit **

i realized if data arrive, arrive out of order , not declare. example:

<ion-content class="map-container">           <map center="{{latitud}}, {{longitud}}" zoom="12" id="map_views" data-tap-disabled="true">               <div id="class" ng-repeat="marker in markers" data-tap-disabled="true">                   <marker position="{{marker.latitud}}, {{marker.longitud}}" on-click="verinfo(marker.nombre,marker.fecha,marker.estado)" data-tap-disabled="true"/>               </div>           </map>         </ion-content> 

output :

kq {latlng: rf, gb: undefined, pixel: undefined, pa: undefined, stop: function} console-via-logger.js:173 poste en mal estado console-via-logger.js:173 09/11/2013 las 20:45 

this quite rare, have no idea because producing.

you should use on-click function working (without interpolation directive {{}}).

<div id="class"  data-tap-disabled="true" ng-repeat="view in views">     <marker position="{{view.latitud}}, {{view.longitud}}" on-click="verinfo(view)" data-tap-disabled="true"/> </div> 

Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -