密码字段的Angularjs验证问题

时间:2015-08-29 08:35:25

标签: javascript angularjs forms validation angularjs-forms

以下是密码字段的angularjs代码:

<input type="password" class="form-control" name="password" ng-model="signup.registerPassword"  ng-minlength="8" >
<small class="errorMessage" data-ng-show="signupForm.registerPassword.$dirty && signupForm.registerPassword.$error.minlength"> Minimum 8 characters.</small>
<small class="errorMessage" data-ng-show="signupForm.registerPassword.$dirty && signupForm.registerPassword.$error.required"> Enter password again.</small>

当我输入低于8个字符的密码时,它没有显示任何错误。

我正在做的错误是什么,我该如何解决?

1 个答案:

答案 0 :(得分:1)

registerPassword的值为ng-modelsignupForm将通过name属性在其中包含其字段。正如您向name="password"字段中的password字段提供password一样,然后内部角度将signupForm字段放在signupForm.registerPassword范围变量中。

signupForm.password更改为<small class="errorMessage" data-ng-show="signupForm.password.$dirty && signupForm.password.$error.minlength"> Minimum 8 characters.</small> <small class="errorMessage" data-ng-show="signupForm.password.$dirty && signupForm.password.$error.required"> Enter password again.</small>

<强>标记

import sys
from cx_Freeze import setup, Executable
path = ["pystest"]+sys.path

build_exe_options = {"packages": ["os","serial"], "excludes": ["tkinter"],"path":path}
#add more package what are using for your app?

base = None
if sys.platform == "win32":
    base = "Win32GUI"

setup(  name = "My test program",
        version = "3.1",
        description = "My test",
        options = {"build_exe": build_exe_options},
        executables = [Executable("pystest.py", base=base)])