Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/75.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.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 将范围变量的值传递到fcsa number min选项_Html_Angularjs_Angularjs Directive_Scope - Fatal编程技术网

Html 将范围变量的值传递到fcsa number min选项

Html 将范围变量的值传递到fcsa number min选项,html,angularjs,angularjs-directive,scope,Html,Angularjs,Angularjs Directive,Scope,使用指令验证输入字段中的数字 我想限制一个字段只获取大于另一个字段中值的数字。谁能告诉我我做错了什么?是否可以将model.Value1的值传递到fcsa number指令中 以下是我的HTML的一部分: <div> <div> <input type="text" fcsa-number="{ min: 1000, max: 1000000000 }" name="Value1" ng-model="model.Value1"/>

使用指令验证输入字段中的数字

我想限制一个字段只获取大于另一个字段中值的数字。谁能告诉我我做错了什么?是否可以将model.Value1的值传递到fcsa number指令中

以下是我的HTML的一部分:

<div>
    <div>
        <input type="text" fcsa-number="{ min: 1000, max: 1000000000 }" name="Value1" ng-model="model.Value1"/>
    </div>
    <div>
        <input type="text" fcsa-number="{min: {{model.Value1}}, max: 1000000000 }" name="Value2" ng-model="model.Value2" />
    </div>
</div>

这是一个plunker,由fcsa编号示例plunker创建。

您是否可以尝试使用
ng attr-*
指令执行相同的操作

所以你应该使用下面的指令和表达式

ng-attr-fcsa-number="{min: {{model.Value1}}, max: 1000000000 }" 
它将帮助您将
model.Value1
的评估值转换为
fcsa number
指令,如下所示

fcsa-number="{min: 10, max: 1000000000 }" 
这是一个plunker,由fcsa编号示例plunker创建。

对不起,我不明白。我到底要试什么?太好了,看起来很管用。唯一奇怪的是,在第二种情况下,数字在千后没有用逗号分隔。但是,当我在当前视图中保存数据,然后再返回到另一个视图时,会出现无数个逗号和其他奇怪的行为。例如,当我将第一个值设置为1000时,fcsa编号的最小选项设置正确,我只能在第二个字段中插入大于等于1000的数字。但当我将第一个值更改为例如2000min时,选项并没有更改,所以在第二个字段中,我仍然可以插入大于等于1000而不是2000的数字。有什么建议吗?你能创建一个plunker吗?我在我的问题中添加了一个plunker。对不起,我错误地在你的答案中添加了它,所以请忽略它。到plunker-有2个字段。两者都设置为值1500。但当您将Value1更改为2000时,您仍然可以将Value2设置为1500。但是Value2不应该低于Value1。