javascript - How to get Parse objectId of clicked item on ion-item -


hi i'm new ionic framework , angularjs. i've learnt use parse storing data. have made code displaying items parse query ion-item using ion-item ng-repeat. here view code :

<ion-item ng-repeat="trip in trips.results" ng-click="getdetail()"> <h2 >{{trip.attributes.title}}</h2 > <p><span am-time-ago="trip.attributes.created"></span></p> <p>{{trip.attributes.owner}}</p> </br> <p>{{trip.attributes.location}}</p> <p>{{trip.attributes.price}} <!--| currency:"rp"--></p> </ion-item > 

service trip :

app.service("tripservice", function ($q, authservice) { var self={ 'load': function () {         self.isloading = true;         var d = $q.defer();          // initialise query         var trip = parse.object.extend("trip");         var tripquery = new parse.query(trip);         tripquery.descending('created');         tripquery.notequalto("owner", "all");          // perform query         tripquery.find({             success: function (results) {                 angular.foreach(results, function (item) {                     var trip = new trip(item);                     self.results.push(trip)                 });                 console.debug(self.results);                  // check if in end of list                 if (results.length == 0) {                     self.hasmore = false;                 }                  // finished                 d.resolve();             }         }); 

and call load in controller. works , shown items in trip query.

what want :

--when clicked on 1 of items, go tripdetail page , shown detail of selected trip. have tried few ways pass parameters return undefined. how pass parameter of clicked items controller? , how use in tripdetail page?

edit: here config detail page when try use href="#/app/home/{{trips.detail.objectid}}":

app.config(function ($stateprovider, $urlrouterprovider) { $stateprovider      .state('app', {     url: '/app',     abstract: true,     templateurl: 'templates/menu.html',     })      .state('app.home', {     url: '/home',     views: {    'menucontent': {     templateurl: 'templates/home.html',     controller: 'triplistctrl'     }     } })     .state('app.home.detail', {     url: '/home/:tripid',     views: {    'menucontent': {     templateurl: 'templates/trip.html',     controller: 'triplistctrl'     }     } }) 

};


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -