我有以下模板:
<tr ng-repeat="dailyInformation in TradodModel.Model.EmployeeDayRelatedData.DailyInformation track by $index" ng-click="DailyInformationRowOnClick(dailyInformation, $event)" data-selected="{{dailyInformation.IsSelected}}" data-rowindex="{{dailyInformation.RowIndex}}">
<td ng-if="!IsHourlyContract() && DailyOverShowType() != @((short) DailyOverShowTypeEnumeration.NotShow) && !DailyOverType()" data-changed="{{dailyInformation.HasOverTimeChange()}}" title="{{dailyInformation.OverTimeTitle()}}" class="{{BgCssClass()}}">
@if (ViewBag.HasWritePermission)
{
@Html.BootstrapTimeTextBox("OverTimeTextBox", "", false, false, 2, false,
new Dictionary<string, object>
{
{"data-disableindexing", "true"},
{"ng-if", "DailyOverShowType() == " + (short)DailyOverShowTypeEnumeration.Editable},
{"ng-model", "dailyInformation.OverTimeFormatted"},
{"ng-disabled", "ViewOnlyMode()"},
{"ng-keydown", "TradodOverTimeOnKeyDown(dailyInformation, $event)"},
{"ng-keyup", "TradodOverTimeOnKeyUp($event)"},
{"ng-focus", "TradodOverTimeOnFocus($event)"},
{"ng-blur", "TradodOverTimeOnBlur()"},
{"data-overtime-index", "{{dailyInformation.RowIndex}}"}
})
}
else
{
<div style="width: 50px;" ng-if="DailyOverShowType() == @((short)DailyOverShowTypeEnumeration.JustShow)">{{dailyInformation.OverTimeFormatted1()}}</div>
}
</td>
</tr>
以下行不起作用: {&#34; ng-model&#34;,&#34; dailyInformation.OverTimeFormatted&#34;}
如果我更改文本框值,并且dailyInformation.OverTimeFormatted
不会更新!
答案 0 :(得分:1)
ng-model
ng-if
范围内not supposed to work
通常您可以使用ng-model="$parent.dailyInformation.OverTimeFormatted"