How to trigger the event in typeahead. I have the code below using typeahead and when user selects any username in the drop-down box of typeahead I want to fill the user.full_name in the text box below. Do you have any suggestion what event should in use in typeahead input. Any suggestion
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="form-group has-feedback" ng-class="showError(userform.username)">
<label class="col-sm-4 control-label">{{'USER.USERNAME' | translate}}:</label>
<div class="col-sm-8">
<input type="text" name="username"
ng-model="user.username" required ng-init="setTimeout($element.focus(), 500)"
typeahead="user as user.username for user in users | filter:$viewValue | limitTo:8"
typeahead-on-select="select($model)"
class="form-control">
<span ng-show="showError(userform.username)" class="glyphicon glyphicon-remove form-control-feedback"></span>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="form-group has-feedback" ng-class="showError(userform.full_name)">
<label class="col-sm-4 control-label">{{'USER.FULLNAME' | translate}}:</label>
<div class="col-sm-8">
<input type="text" class="form-control" name="full_name" ng-model="user.full_name">
<span ng-show="showError(userform.full_name)" class="glyphicon glyphicon-remove form-control-feedback"></span>
</div>
</div>
</div>
</div>
Below is part of my controller
.controller('AdminUsersController', ['$rootScope', '$scope', '$state', '$stateParams', '$modal', '$log', '$timeout', 'usersApi', 'policiesApi','workspacesApi', 'msg', '$filter',
function($rootScope, $scope, $state, $stateParams, $modal, $log, $timeout, usersApi, policiesApi, workspacesApi,msg, $filter) {
var self = this,
limit = 100,
....
$scope.select = function (item) {
console.log('********* This is select ');
$scope.user.full_name = item.full_name;
console.log('foo', item);
};
// Finally initialize the page
self.refresh();
...