0

i have a function, that will give a string, i need to send that string on to the DOM input box

How could i achieve this.

if (results[1]) {
        var Canvas = document.getElementById(s);
        alert("Location: " + results[1].formatted_address);
}



<section class="field-section">
      <input id="s" value="" type="text" class="text-input text-input--underbar trn"
        ng-model="text" placeholder="Street Address,City,State" 
        data-trn-key="home_search_placeholder" 
        style="display: block; width: 100%">
</section>

What i actually need after if statement becomes true the sting in "result" should be passed on to the input box

Could someone help me.

Yokesh Varadhan
  • 1,636
  • 4
  • 21
  • 47

1 Answers1

0

This is what you should do. Since you are using Angular, you need not use javascript separately to access the textbox.

if(results[1]) {
            $scope.text = results[1].formatted_address;
            alert("Location: " + results[1].formatted_address);
    }
Nikhilesh K V
  • 1,480
  • 13
  • 20