私があなたを助けてくれることを願っています。ng-modelフィールドの値を条件付き変更に基づいて変更してください
(一見)単純な条件文に基づいて私のAngularJSビューフィールドの値を設定したいと思います。
私は答えがとてもシンプルになると信じていますが、1時間以上の検索と試してもそれを見つけることはできませんでした。
私は間違った指示(私はng-ifとng-changeのようなものを試しました)を使用しようとしているかもしれないと思います。
私は(ng-if="reportSettingsData.ReportFrequencyName.ReportFrequencyId == Enum.ReportFrequency.Weekly)
週刊するレポートの頻度を変更は私のNG-モデルフィールドreportSettingsData.ReportFrequencyWeekdayName = "None"
の値を設定します。
は、これは私が達成したいものです。
およびその逆。レポートの頻度をMonthlyに変更すると、reportSettingsData.ReportFrequencyMonthDayName = "None"
の値が設定されます。(ng-if="reportSettingsData.ReportFrequencyName.ReportFrequencyId != Enum.ReportFrequency.Weekly)
<!-- Frequency -->
<div class="col-md-3">
<label>Frequency</label>
<div class="input-dropdown">
<cc-dropdown cc-placeholder="Report Frequency"
ng-model="reportSettingsData.ReportFrequencyName"
ng-options="reportSettingsData.SelectableReportFrequencyNames"
cc-fields="ReportFrequencyName"
ng-change="frequencyChanged()"
cc-key-field="ReportFrequencyId"
cc-allow-search="reportSettingsData.SelectableReportFrequencyNames != null && reportSettingsData.SelectableReportFrequencyNames.length > 5"
name="iFrequencyName">
</cc-dropdown>
</div>
</div>
<!-- Week Days/Month Days -->
<div class="col-md-3">
<label>Frequency Options</label>
<div class="input-dropdown" ng-if="reportSettingsData.ReportFrequencyName.ReportFrequencyId != Enum.ReportFrequency.Weekly">
<cc-dropdown cc-placeholder="Report Frequency Option"
ng-model="reportSettingsData.ReportFrequencyMonthDayName"
ng-options="reportSettingsData.SelectableReportFrequencyMonthDays"
ng-disabled="reportSettingsData.ReportFrequencyName.ReportFrequencyId != Enum.ReportFrequency.Monthly"
cc-fields="ReportFrequencyMonthDayName"
cc-key-field="ReportFrequencyMonthDayId"
cc-allow-search="true"
name="iFrequencyMonthDays">
</cc-dropdown>
</div>
<div class="input-dropdown" ng-if="reportSettingsData.ReportFrequencyName.ReportFrequencyId == Enum.ReportFrequency.Weekly">
<cc-dropdown cc-placeholder="Report Frequency Option"
ng-model="reportSettingsData.ReportFrequencyWeekdayName"
ng-options="reportSettingsData.SelectableReportFrequencyWeekdays"
cc-fields="ReportFrequencyWeekdayName"
cc-key-field="ReportFrequencyWeekdayId"
cc-allow-search="true"
name="iFrequencyWeekdays">
</cc-dropdown>
</div>
</div>
大変ありがとうございます!
私はあなたの提案を実装しており、意図した目的のために働いていますが、期待通りのものではありません。あなたが喜んでいるなら、私の編集された質問を見てください。ありがとう! – onmyway