Angular JS - v1.2.0-rc.3 Angular Bootstrap - 0.12.0
控制器:
app.controller('controlsController', ['$scope', '$http', function($scope, $http) {
$scope.selected = undefined;
$scope.getLocation = function(val) {
return $http.get('http://maps.googleapis.com/maps/api/geocode/json', {
params: {
address: val,
sensor: false
}
}).success(function(response){
return response.data.results.map(function(item){
return item.formatted_address;
});
});
};
}]);
玉:
input(type='text'
ng-model='asyncSelected'
placeholder='find...'
typeahead='address for address in getLocation($viewValue)'
typeahead-loading='loadingLocations'
class='form-control')
结果:
没有
我尝试使用调用getLocation
的按钮代替输入,然后调用函数OK。有什么想法吗?
答案 0 :(得分:0)
您不需要ui-bootstrap-tpls.min.js
和
ui-bootstrap.min.js
。无论是其中一个。
请记住将依赖项添加到应用程序的模块中。
var app = angular.module('myApp', ['ui.bootstrap']);