I'm starting to learn AngularJS for a web app, and I have an issue with understanding the workflow of the framework.
I have 2 dropdowns :
<select class='selectorDropdown' ng-model='selectedElement' ng-change='selectedElementChange()'>
<option value='0' disabled selected>Option0
<option value='1'>Option1
<option value='2'>Option2
</select>
<select class='selectorDropdown' id='selector2' disabled>
<option value='3'>Option1
<option value='4'>Option2
</select>
I want the second dropdown to be enabled only after another option than Option0 has been selected on the first dropdown. So here's my Javascript code :
$scope.selectedElementChange = function() {
document.getElementById('selector2').disabled = true;
}
So far, it looks like regular Javascript (and I'm manipulating the DOM), so I guess this is not really the way AngularJS was mean to be used. Could someone help me understand the "correct" way to do this with AngularJS ?