Saturday 15 August 2015

javascript - Get clicked object value with AngularJS -



javascript - Get clicked object value with AngularJS -

i'm trying rewrite live search feature using angularjs, can't find how can grab clicked item in list. see below:

<div id="searchresults" ng-show="speaker.list.length > 0"> <ul ng-repeat="person in speaker.list"> <li ng-click="speaker.updatefields()">{{person.name}}</li> </ul> </div>

in speaker.updatefields() method, how reference person.name? there different way should done?

thanks.

pass in!

<li ng-click="speaker.updatefields(person.name)">{{person.name}}</li>

and js

$scope.updatefield = function(name) { //console.log(name) }

javascript angularjs

No comments:

Post a Comment