I have the following drop-down list on my angular JS page:
<div class="col-md-4 fieldMargin">
<div class="dropdownIcon">
<select name="actions" id="actions"
ng-init="Data.formStatus.Action=Data.Actions[0]"
ng-options="option.Value for option in Data.Actions"
ng-focus="ActionsLabel = true" ng-blur="ActionsLabel = false;"
ng-model="Data.formStatus.Action">
</select>
<label for="actions" class="labelColor"
ng-class="{'dropdownLabelFloat' : (ActionsLabel || Data.formStatus.Action != null), 'dropdownLabel' : !ActionsLabel && !Data.formStatus.Action }">
Action
</label>
</div>
</div>
These are the options for the above drop-down:
Test1
Test12
Test14
Test18
Test25
and so on
Based on whatever selection, user makes, in the above drop-down list, I want to change the label text of another control on the same page:
this is another control:
<div class="col-md-12 inputEmailSection">
<input type="text" name="to" id="to"
ng-focus="ToLabel = true" ng-blur="ToLabel = false;"
ng-model="Data.EmailInput.To" />
<label for="to" class="labelColor"
ng-class="{'inputLabelFloat' : (ToLabel || Data.EmailInput.To!= null), 'inputLabel' : !ToLabel && !Data.EmailInput.To}">
To
</label>
</div>
In the Action drop-down, if the user selects "Test1" then I want the data to be coming from model:
Data.EmailInput.To
but if the user selects "Test18" from the Action drop down then I want the model to be:
Data.EmailInput.ToSpecialCase
<div class="col-md-12 inputEmailSection">
<input type="text" name="to" id="to"
ng-focus="ToLabel = true" ng-blur="ToLabel = false;"
ng-model="Data.EmailInput.ToSpecialCase" />
<label for="to" class="labelColor"
ng-class="{'inputLabelFloat' : (ToLabel || Data.EmailInput.To!= null), 'inputLabel' : !ToLabel && !Data.EmailInput.To}">
To
</label>
</div>
Is it possible to do something on angular Js HTML page. I know, I can put if else condition on angular Js html page like this:
<div ng-if="someCondition"></div>
<div ng-else-if="someOtherCondition"></div>
I am not sure how to capture the selected value from the Action drop-down and then make a condition from that selected value. I am very new to angular JS.
Any help on this will be highly appreciated.