Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 句柄浮点输入交叉串列器_Html_Input_User Input_Angular Ngmodel_Angular Directive - Fatal编程技术网

Html 句柄浮点输入交叉串列器

Html 句柄浮点输入交叉串列器,html,input,user-input,angular-ngmodel,angular-directive,Html,Input,User Input,Angular Ngmodel,Angular Directive,在angular应用程序中,我需要将范围变量绑定到浮点用户输入 <my-float ng-model="myValue" name="floatValue"></my-float> <button type="button" ng-disable="myValue.$invalid">Submit</submit> 使用html <input name=&q

在angular应用程序中,我需要将范围变量绑定到浮点用户输入

<my-float ng-model="myValue" name="floatValue"></my-float>
<button type="button" ng-disable="myValue.$invalid">Submit</submit>
使用html

 <input name="x" type="text" my-float ng-model="value">
 <div>error:{{f.x.$invalid}}</div>

错误:{f.x.$invalid}

这里有一个

我想说的是,你把myValue作为字符串,为了有效性,你可以说:

1. if ( myValue[n-2] == ',' or myValue[n-3] ==',')
split the string into two by ,
else split the string into two by .
2. check second splited part is a number and length is less than two else invalid input 
3. check first part is number , If yes a valid input or else invalid

我需要限制用户只看到允许的字符。。。所以我尝试使用$formatters和$render
1. if ( myValue[n-2] == ',' or myValue[n-3] ==',')
split the string into two by ,
else split the string into two by .
2. check second splited part is a number and length is less than two else invalid input 
3. check first part is number , If yes a valid input or else invalid