angularjs input type=radio isChecked

前端之家收集整理的这篇文章主要介绍了angularjs input type=radio isChecked前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
1、html:
<input type="radio" ng-model="typeModel.isChecked" ng-click="typeRadioClickFun($event.target)" value="0">&nbsp;{{'PROPERTY.NODE.DUE.DATE.VARIABLE.LABEL' | translate}}

<input type="radio" ng-model="typeModel.isChecked" ng-click="typeRadioClickFun($event.target)" value="1">&nbsp;{{'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">&nbsp;{{'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">&nbsp;{{'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">&nbsp;{{'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

猜你在找的Angularjs相关文章