Reputation: 25
I want to edit fields before updating them to my JSON file. The following shows the details in the text/number fields (not the dates or select fields) (this is my test run to see if it'll work)
<label>ID: </label>
<input type = 'number' value = '{{projectDetails.ProjectID}}'></input><br>
<label>Name: </label>
<input type = 'text' value = '{{projectDetails.Name}}'></input><br>
<label>Start Date: </label>
<input type = 'date' value = '{{projectDetails.StartDate}}'></input><br>
<label>End Date: </label>
<input type = 'date' value = '{{projectDetails.EndDate}}'></input><br>
<label>Status: </label>
<select>
<option value="2">Current</option>
<option value="3">Closed</option>
<option value="4">Scheduled</option>
<option value="5">Unscheduled</option>
</select><br>
<label>Owner: </label>
<input type = 'text' value = '{{projectDetails.ContactPerson}}'></input><br>
<label>Contractor: </label>
<input type = 'text' value = '{{projectDetails.Contractor}}'></input><br>
<label>Manager: </label>
<input type = 'text' value = '{{projectDetails.ProjectManager}}'></input><br>
But when I add an ng-model it no longer has the values in the fields except for the ProjectID field
<label>ID: </label>
<input type = 'number' value = '{{projectDetails.ProjectID}}' ng-model = 'UProjectID'></input><br>
<label>Name: </label>
<input type = 'text' value = '{{projectDetails.Name}}' ng-model = 'UName'></input><br>
<label>Start Date: </label>
<input type = 'date' value = '{{projectDetails.StartDate}}' ng-model = 'UStartDate'></input><br>
<label>End Date: </label>
<input type = 'date' value = '{{projectDetails.EndDate}}' ng-model = 'UEndDate'></input><br>
<label>Status: </label>
<select ng-model = 'UStatus'>
<option value="2">Current</option>
<option value="3">Closed</option>
<option value="4">Scheduled</option>
<option value="5">Unscheduled</option>
</select><br>
<label>Owner: </label>
<input type = 'text' value = '{{projectDetails.ContactPerson}}'ng-model = 'UContactPerson'></input><br>
<label>Contractor: </label>
<input type = 'text' value = '{{projectDetails.Contractor}}' ng-model = 'UContractor'></input><br>
<label>Manager: </label>
<input type = 'text' value = '{{projectDetails.ProjectManager}}' ng-model = 'UProjectManager'></input><br>
My code seems to not like the ng-models. What is supposed to happen is that when I click on a project the details are already in the text/number/date fields where the user can then edit/update them before posting them. Any ideas as to why it doesn't like the ng-model?
Upvotes: 1
Views: 110