Saturday, October 21, 2017

ng-model not work within ng-if and ng-repeat, AngularJs?

I have the following template:

<tr ng-repeat="dailyInformation in TradodModel.Model.EmployeeDayRelatedData.DailyInformation track by $index" ng-click="DailyInformationRowOnClick(dailyInformation, $event)" data-selected="" data-rowindex="">
        <td ng-if="!IsHourlyContract() && DailyOverShowType() != @((short) DailyOverShowTypeEnumeration.NotShow) && !DailyOverType()" data-changed="" title="" class="">
            @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", ""}
                })
            }
            else
            {
              <div style="width: 50px;" ng-if="DailyOverShowType() == @((short)DailyOverShowTypeEnumeration.JustShow)"></div>
            }
          </td>
</tr>

The following line not work:
{“ng-model”, “dailyInformation.OverTimeFormatted”}

and dailyInformation.OverTimeFormatted doesn’t update if I change textbox value !

Source: AngularJS



from Angular Questions https://angularquestions.com/2017/10/21/ng-model-not-work-within-ng-if-and-ng-repeat-angularjs/
via @lzomedia #developer #freelance #web #lzomedia.com

No comments:

Post a Comment