http://angular-ui.github.io/bootstrap/を使用して Angular で先行入力を実装しようとしています。先行入力フィールドには完全な住所が表示されますが、クリックすると別のフィールドにその住所の郵便番号だけが入力されます。これには ng-change または ng-click を使用しようとしていますが、成功しません..
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>
何か案は?