使用angular-form-validator对angular2表单应用验证会在控制台上出错

时间:2017-08-28 16:09:39

标签: angular validation angular2-template angular2-forms

Uncaught ReferenceError: angular is not defined
    at Object.a.6../controller/ngFormValidatorCtrl (eval at webpackJsonp.../../../../script-loader/addScript.js.module.exports (addScript.js:9), <anonymous>:1:10372)
    at s (eval at webpackJsonp.../../../../script-loader/addScript.js.module.exports (addScript.js:9), <anonymous>:1:254)
    at r (eval at webpackJsonp.../../../../script-loader/addScript.js.module.exports (addScript.js:9), <anonymous>:1:421)
    at eval (eval at webpackJsonp.../../../../script-loader/addScript.js.module.exports (addScript.js:9), <anonymous>:1:438)
    at eval (<anonymous>)
    at webpackJsonp.../../../../script-loader/addScript.js.module.exports (addScript.js:9)
    at Object.../../../../script-loader/index.js!../../../../angular-form-validator/dist/js/ngFormValidator.min.js (ngFormValidator.min.js?c268:1)
    at __webpack_require__ (bootstrap e0780ad229468d3f0586:54)
    at Object.2 (scripts.bundle.js:66)
    at __webpack_require__ (bootstrap e0780ad229468d3f0586:54)
a.6../controller/ngFormValidatorCtrl @ VM11782:1
s @ VM11782:1
r @ VM11782:1
(anonymous) @ VM11782:1
webpackJsonp.../../../../script-loader/addScript.js.module.exports @ addScript.js:9
../../../../script-loader/index.js!../../../../angular-form-validator/dist/js/ngFormValidator.min.js @ ngFormValidator.min.js?c268:1
__webpack_require__ @ bootstrap e0780ad229468d3f0586:54
2 @ scripts.bundle.js:66
__webpack_require__ @ bootstrap e0780ad229468d3f0586:54
webpackJsonpCallback @ bootstrap e0780ad229468d3f0586:25
(anonymous) @ scripts.bundle.js:1

我使用的是:https://www.npmjs.com/package/angular-form-validator和angular2。虽然使用自定义验证器进行验证是一个选项,如下所示:https://angular.io/guide/form-validation。但是,我希望尽可能地将验证保留在HTML文件中。代码运行正常但控制台上有错误。任何人都可以建议删除此错误跟踪吗?

0 个答案:

没有答案