Hey there, I'm facing a problem,
I've developed a dual input directive and need some assistance with the following issue. When I change the model value to undefined in the controller, the view values are not cleared. Here are the code snippets:
Here is my Dual Input Directive implementation:
angular.module("awcQuoteBuy.directives")
.directive('dualInput', function($timeout, inputValidationService) {
return {
restrict: 'E',
templateUrl: 'app/partials/common/doubleInput.html',
scope: {
modelValue: '=',
size: '@',
fieldError: '@',
blurFn: '&loseFocus'
},
...
The corresponding HTML snippet:
<dual-input model-value="dualInput[$index]" ng-switch-when="DUAL_NUMBER" size="{{q.length}}"
field-error="{{q.invalid || (nextClicked && !validateGeneralQuestion(acc.memberId, q))}}" id="{{'gQDual'+$index}}"
lose-focus="saveGeneralAnswer(acc.memberId, q)"></dual-input>
When I set the scope value to undefined or null in my Controller, the entered values in the view are not cleared. Can you guide me on how to resolve this issue?
$scope.dualInput[$index]=undefined;