0

I have the below box to fill up the information :

enter image description here

I have the below code to create the above box :

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>


  <!-- server Location Field  -->

    <div  class="form-group" style="width: 80%; margin-left:10%;" > 
  <span style="position: relative;color:red; left: -10px"><font>*</font> </span>
   <input  maxlength="20" type="text"  class="form-control filled" ng-model="ctrl.form1.serverLocation" placeholder="serverLocation"  name="serverLocation" ng-required="ctrl.form1.date=='Enable'"></input>

  <span ng-show="f2.serverLocation.$dirty && f2.serverLocation.$error.required" style="color: red"> server Location is required</span>
    </div>

I am trying to create a button , clicking on which the value to be filled inside the box is fetched from a .text file.For instance , for the above box the value to be picked from the text file is "server_location" . The text file includes many fields such as :

image_location=pqc_11
db_location=xyz_2233
server_location=abc-1122

Kindly help on how to fill up the box on click of a button .I am using angular JS to create the fill up box .Thanks in advance.

onetwo12
  • 2,359
  • 5
  • 23
  • 34
jane
  • 211
  • 9
  • 30
  • 1
    Read data from the file as [Check this link](https://stackoverflow.com/a/16931623/562182) and simply bind to box – jitender Oct 10 '17 at 06:42

1 Answers1

0

I think you should work on angular 2 as your life will be easier. On AngularJS simply use ngClick https://docs.angularjs.org/api/ng/directive/ngClick

Add it on your input, then fill the value field

Where fillInput() can both use :

1 - ElementRef to access DOM element and change it.

2 - ViewChild <input #viewInput type="text" value="{{serverLocation}}"/>

andrea06590
  • 1,259
  • 3
  • 10
  • 22