2016-10-20 19 views
3

我正在嘗試在我的Angular2 angular-seed基礎項目中集成ng2-validation。我遵循ng2-validation文檔中提到的步驟,但是我收到以下錯誤。在這方面請幫助我。ng2驗證不能在Angular2中使用angular-seed

"(SystemJS) Unexpected token < 
    SyntaxError: Unexpected token < 
     at Object.eval (http://localhost:5555/node_modules/ng2-validation/dist/directives/range-length.js:13:10) 
     at eval (http://localhost:5555/node_modules/ng2-validation/dist/directives/range-length.js:43:4) 
     at eval (http://localhost:5555/node_modules/ng2-validation/dist/directives/range-length.js:44:3) 
    Evaluating http://localhost:5555/node_modules/ng2-validation/dist/ 
    Evaluating http://localhost:5555/node_modules/ng2-validation/dist/directives/range-length.js 
    Evaluating http://localhost:5555/node_modules/ng2-validation/dist/directives.js 
    Evaluating http://localhost:5555/node_modules/ng2-validation/dist/index.js 
    Evaluating http://localhost:5555/app/app.module.js 
    Evaluating http://localhost:5555/app/main.js 
    Error loading http://localhost:5555/app/main.js" 

回答

0

使用此配置文件數組中karma.conf.js:

{ 模式: 'node_modules/NG2-驗證/ * JS', 包括:虛假, 觀看:假 },{ 模式: 'node_modules/NG2-驗證/ **/* JS', 包括:虛假, 看:假 }

基於NG2-驗證的版本,你可以使用configurati請按鏈接中的說明操作:https://github.com/Nightapes/ng2-validators/issues/11