<div class="form-group padd form-group-lg"> <div class="container"> <data-sm:duallist-directive ng-required="false" unassigned-items-title="'@String.Format(Labels.availableX, Labels.modifiers)'" unassigned-items="currentModifierGroup.unassignedItems" assigned-items-title="'@String.Format(Labels.assignedX, Labels.modifiers)'" assigned-items="currentModifierGroup.assignedItems" sortable="false" selected-item="currentModifierGroup.selectedItem"> </data-sm:duallist-directive> </div> </div> <div class="form-group"> <label class="control-label col-md-2 col-lg-2" title="@Labels.Macros">@Labels.Macros:</label> <div class="col-md-8 col-lg-8"> <textarea class="form-control" rows="5" style="resize: none" ng-model="currentModifierGroup.selectedItem.macro" ng-model-options="{ allowInvalid: true }"></textarea> </div> </div>Here is what I think is happening: when I simply navigate between the assigned items (which, in turn, is supposed to update the Macros text area with that item's associated macro), I get the form state dirty. The user didn't change anything, so that $scope.form.dirty state is not really an indicator that something has changed.
<div> <select class="form-control select-list" ng-change="onChanged(assigned)" multiple ng-model="assigned" ng-options="assignedItem.descrip for assignedItem in assignedItems| orderBy: 'SortOrder' | filter: filterCriteria" ></select> </div>directive controller:
$scope.onChanged = function (assigned) { $scope.selectedItem = assigned[0]; }
<select class="form-control select-list ng-valid ng-dirty ng-valid-parse ng-touched" ng-change="onChanged(assigned)" multiple="" ng-model="assigned" ng-options="assignedItem.descrip for assignedItem in assignedItems| orderBy: 'SortOrder' | filter: filterCriteria"><option value="0" label="Bonus - Day Visitor [**BONUS**,DAYVISITOR,BONUS]">Bonus - Day Visitor [**BONUS**,DAYVISITOR,BONUS]</option> <option value="1" label="Creepy Crawlers [EVENTS,ACTIVITIES,CREEPYCRWL]">Creepy Crawlers [EVENTS,ACTIVITIES,CREEPYCRWL]</option> <option value="2" label="Dinosaur Adventures [EVENTS,ACTIVITIES,DINOADVNTR]">Dinosaur Adventures [EVENTS,ACTIVITIES,DINOADVNTR]</option> <option value="3" label="Face Painting [EVENTS,ACTIVITIES,FACEPAINT]">Face Painting [EVENTS,ACTIVITIES,FACEPAINT]</option></select>UPDATE 2. Also asked here http://stackoverflow.com/questions/33002433/angularjs-list-control-how-to-avoid-setting-forms-dirty-flag