0

I have this 2 select options in my view and I need to set the second select value to "original" before disable it

<div class="form-group">
        <label>Download mode:</label>
        <select ng-model="properties.DownloadMode.PropertyValue" ng-change="EnableDisableDownloadFilePresets(properties.DownloadMode.PropertyValue)" class="form-control">
            <option value="download" selected> Direct Download</option>
            <option value="link"> Canto Link</option>
        </select>
    </div>
    <div class="form-group">
        <label>Download presets</label>
        <select ng-model="properties.DownloadFilePresets.PropertyValue" ng-disabled="DownloadFilePresetsIsDisabled" class="form-control">
            <option value="original" selected> Original</option>
            <option value="all"> All file presets</option>
        </select>
    </div>

and this is my function

$scope.EnableDisableDownloadFilePresets = function (selectedValue) {
        console.log(selectedValue);
        if (selectedValue === "link") {
            // set Download presets value to "original"
            
            // disable Download presets
            $scope.DownloadFilePresetsIsDisabled = true;
        } else {
            // enable Download presets
            $scope.DownloadFilePresetsIsDisabled = false;
        }
    }
CMartins
  • 3,247
  • 5
  • 38
  • 53

1 Answers1

0

The solution was setting this

$scope.properties.DownloadFilePresets.PropertyValue = "original";

My full function is now

$scope.EnableDisableDownloadFilePresets = function (selectedValue, e) {
        console.log(selectedValue);
        if (selectedValue === "link") {
            // set Download presets value to "original"
            $scope.properties.DownloadFilePresets.PropertyValue = "original";
            // disable Download presets
            $scope.DownloadFilePresetsIsDisabled = true;
        } else {
            // enable Download presets
            $scope.DownloadFilePresetsIsDisabled = false;
        }
    }
CMartins
  • 3,247
  • 5
  • 38
  • 53