gpt4 book ai didi

javascript - ng-model 在 ng-if 和 ng-repeat、AngularJs 中不起作用?

转载 作者:行者123 更新时间:2023-11-30 21:03:39 24 4
gpt4 key购买 nike

我有以下模板:

<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>

以下行不起作用:{"ng-model", "dailyInformation.OverTimeFormatted"}

dailyInformation.OverTimeFormatted 如果我更改文本框值则不会更新!

最佳答案

ng-modelnot supposed to workng-if

通常您可以使用 ng-model="$parent.dailyInformation.OverTimeFormatted"

避免这种情况

关于javascript - ng-model 在 ng-if 和 ng-repeat、AngularJs 中不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46861511/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com