AngularJS BootstrapUI Typeahead z funkcją wyboru obiektów i wyboru

Próbuję zaimplementować typahead za pomocą Angularhttp://angular-ui.github.io/bootstrap/, gdzie pole typu nagłówka wyświetla pełne adresy, ale po kliknięciu inne pole jest wypełniane tylko kodem pocztowym dla tego adresu. Próbuję użyć do tego ng-change lub ng-click, ale bez powodzenia.

http://jsfiddle.net/UxTBB/2/

angular.module('myApp', ['ui.bootstrap'])
    .controller("mainCtrl", function ($scope) {
    $scope.selected = '';
    $scope.states = [{postcode:'B1',address:'Bull ring'},{postcode:'M1',address:'Manchester'}];
    $scope.setPcode = function(site) {
        $scope.selPcode = site.postcode;
        };
});

<div class="container">
    <div ng-controller="mainCtrl" class="row-fluid">
        <form class="row-fluid">
            <div class="container-fluid">
                postcode <input type="text" ng-model="selPcode" />
                typeahead <input type="text"  ng-change="setPcode(site)" ng-model="selected" typeahead="state.address for state in states | filter:$viewValue" />
            </div>
        </form>
    </div>
</div>

Jakieś pomysły?

questionAnswers(6)

yourAnswerToTheQuestion