I'm using AngularJS and have a switch, I want it to have that if the switch is turned off that my md-input-container is disabled by default. And when I click the switch to on that the md-input-container is enabled again.
What I have right now works a little bit, but when I want to turn the switch off again the md-input-container is still enabled.
My HTML code:
<div class="col-md-2">
<md-switch ng-click="enabled()">
Online verkoop
</md-switch>
</div>
<div class="col-md-2">
<md-input-container class="md-block">
<label style="color: #e94e18;">Bezorgkosten (€)</label>
<input ng-model="bezorgkosten" ng-disabled="disabled">
</md-input-container>
</div>
Javascript:
//disable switches
$scope.disabled= true;
$scope.enabled = (function(){
$scope.disabled = false;
});