From b519b632686f1dd8ba0629603d15784491633221 Mon Sep 17 00:00:00 2001 From: Pawel Kozlowski Date: Thu, 22 May 2014 20:30:36 +0200 Subject: [PATCH] docs(typeahead): use array.map to shorten async example --- src/typeahead/docs/demo.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/typeahead/docs/demo.js b/src/typeahead/docs/demo.js index 24bc2a2dad..031eac9272 100644 --- a/src/typeahead/docs/demo.js +++ b/src/typeahead/docs/demo.js @@ -9,12 +9,10 @@ angular.module('ui.bootstrap.demo').controller('TypeaheadCtrl', function($scope, address: val, sensor: false } - }).then(function(res){ - var addresses = []; - angular.forEach(res.data.results, function(item){ - addresses.push(item.formatted_address); + }).then(function(response){ + return response.data.results.map(function(item){ + return item.formatted_address; }); - return addresses; }); };