In html we use to write like this <input type="text" value="8">
. I am facing two problems while I am doing it using angular js tags.
I want to set some value which I am taking from database like
value=8
.And I am using one drop down in this form. I want to auto select some value which is set in database.
<form id="attendanceSheet" name="attendanceSheet" ng-submit="fillUpTimeSheet(attendanceSheet.$valid)" >
<table ng-table="tableParams" class="table">
<tr ng-repeat="resource in resources">
<td data-title="'Working Hours'" style="text-align:center" ng-if="resource.isBillable == 1">{{resource.billable_hours}}h <input type="number" style="width: 55px;" min="0" max="8" ng-init="timeSheet[$index] = {}" ng-model="timeSheet[$index].billableHour" required></td>
<td data-title="'Non Billable Resource'" style="text-align:center" ng-if="resource.isBillable == 1"><select data-ng-options="o.resource_name for o in nonBillableResources" style="width: 150px;" ng-model="timeSheet[$index].nonBillableResource"></select></td>
</tr>
</table>
</form>
To set the value I tried like this .. value="resource.id"
OR ng-init="timeSheet[$index] = {resource.id}"
Please I need help.
value
field of the input. – JB Nizet Oct 19 '14 at 8:56ng-model="resource.billable_hours"
so, now I am getting the value in text box. But when I submit the form I get null object. – Sariban D'Cl Oct 19 '14 at 10:56ng-repeat="resource in resources"
because many records are available in db. When I removeng-repeat="resource in resources"
then I get the value after submiting the form. – Sariban D'Cl Oct 19 '14 at 11:00