so I have a chat application, in the home.html will display a friend list of the user, I use ng-repeat to display the friend. and this is the code:
<div class="scrollable">
<div class="scrollable-content">
<div class="list-group">
<div class="list-group-item">
<h5>Welcome <b>{{ datauser['data']['nama'] }}</b></h5>
<input type="search" class="form-control app-search" placeholder="Search.." data-ng-model="search" />
<div class="list-group-item media" href="#" ng-repeat="friend in datauser['data']['friends'] | filter : {nama : search}" data-ng-click="chatWith(friend.userid , friend.nama)" data-ng-class="(friend['ischat'] ? 'blokchat' :'')">
<div class="pull-left">
<i class="fa fa-user chat-user-avatar"></i>
</div>
<div class="media-body" >
<h5 class="media-heading">{{friend.nama}} <span class="badge bg-danger" data-ng-if="friend['ischat']">*</span></h5>
</div>
</div>
</div>
</div>
</div>
the example from this code is like this:
friends in this friend list is arranged by the time they become friend, so the new friend will be on bottom of the list. my question is how to take the value of the array from the friend list? this value will I use in my Speech Recognition. Example, if I want to chat with 'test' I will speak "Chat whit friend number 2". this is the speech recognition code:
$scope.recog = function() {
var recognition = new SpeechRecognition();
recognition.onresult = function(event) {
var msg = 'Sorry, there is no such a command like that';
var result = event.results[0][0].transcript;
switch(result){
case 'go to home':
$location.path('/home');
break;
case 'go to add friend':
$location.path('/addfriend');
break;
case 'go to friend request':
$location.path('/friendrequest');
break;
case 'go to pending request':
$location.path('/penddingrequest');
break;
case 'add':
$scope.addfriends();
break;
case 'send':
$scope.sendMessage();
break;
default:
navigator.notification.alert(msg, '', 'Undefined Command!','ok');
break;
};
$scope.$apply()
};
recognition.start();
};
So, how do I take the value from ng-repeat? thanks