I am trying to create a directive that can be used to reset the check status of several input controls in a group when one of the control values ββchanges. Groups are identified by the attribute of a directive set in HTML. Example: - Both inputs From date and Date reset the validity state when the user input value is changed by the user
This is what I still have
Js / angular
angular.module('myModule').directive('groupedInputs', function () { return { restrict: 'A', require: '?ngModel', link: function (scope, element, attrs, ctrl) { element.on('change', function () {
HTML
<input name="FromDate" type="date" class="form-control" ng-model="model.FromDate" grouped-inputs="FromToDates"> <input name="ToDate" type="date" class="form-control" ng-model="model.ToDate" grouped-inputs="FromToDates">
It can reset the validity of its own input control, but cannot access other input elements with a directive and the same attribute value. What is the best way for angular to access other controls by querying inputs with the same attribute?
source share