I want to dynamically add autocomplete address text input, but I'm unsure how to convert those addresses into an array of longitudes and latitudes. My goal is to have a set of waypoints to place on a map, but as a beginner in JavaScript and AngularJS, I am unsure of how to achieve this:
HTML:
<div ng-show="content == 'first'" ng-app="angularjs-starter" class="form-group" ng-controller="MyCtrl">
[<span ng-repeat="input in inputs">"{{input.value}}"</span>]
<label class="control-label">tournee</label>
<div ng-repeat="input in inputs">
<!-- autocomplete address inputs-->
<input google-place type="text" ng-model="input.value" />
<button ng-click="removeInput($index)">Remove</button>
</div>
<button ng-click="addInput()">add input</button>
</div>
Angular script
var app = angular.module('angularjs-starter', []);
app.controller('MyCtrl', ['$scope', function($scope) {
$scope.inputs = [];
$scope.addInput = function() {
$scope.inputs.push({
value: ''
});
}
$scope.removeInput = function(index) {
$scope.inputs.splice(index, 1);
}
}]);