<input type="radio" ng-model="typeModel.isChecked" ng-click="typeRadioClickFun($event.target)" value="0"> {{'PROPERTY.NODE.DUE.DATE.VARIABLE.LABEL' | translate}} <input type="radio" ng-model="typeModel.isChecked" ng-click="typeRadioClickFun($event.target)" value="1"> {{'PROPERTY.NODE.DUE.DATE.FIXEDVALUE.LABEL' | translate}} <input type="radio" ng-model="unitModel.isChecked" ng-disabled="unitModel.isChecked==-1" ng-click="unitRadioClickFun($event.target)" value="0"> {{'PROPERTY.NODE.DUE.DATE.MINUTE.LABEL' | translate}} <input type="radio" ng-model="unitModel.isChecked" ng-disabled="unitModel.isChecked==-1" ng-click="unitRadioClickFun($event.target)" value="1"> {{'PROPERTY.NODE.DUE.DATE.HOUR.LABEL' | translate}} <input type="radio" ng-model="unitModel.isChecked" ng-disabled="unitModel.isChecked==-1" ng-click="unitRadioClickFun($event.target)" value="2"> {{'PROPERTY.NODE.DUE.DATE.DAY.LABEL' | translate}}
2、js:
/*type radio*/ $scope.typeRadioClickFun=function(target){ if(target.value!=undefined){ if(target.value==0){ $scope.unitModel={isChecked:-1};//unit radio disable }else{ $scope.unitModel={isChecked:0};//unit radio enable 0 checked } $scope.expressionModel=''; } }
var pattern="^\\d+$"; var reg=new RegExp(pattern); //prefix if(expV.match(reg)==null){ alert("表达式仅允许输入非负整数!"); return; }else{ var unit='M'; if(unitV==0){ unit='M'; }else if(unitV==1){ unit='H'; }else if(unitV==2){ unit='D'; } $scope.property.value='PT'+trimStr(expV)+unit; }原文链接:https://www.f2er.com/angularjs/147542.html