Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/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
Angular 因果报应可以';不能识别角度指令_Angular_Webpack_Karma Jasmine_Angular2 Testing - Fatal编程技术网

Angular 因果报应可以';不能识别角度指令

Angular 因果报应可以';不能识别角度指令,angular,webpack,karma-jasmine,angular2-testing,Angular,Webpack,Karma Jasmine,Angular2 Testing,我们的项目结构如下: 我们的项目成功编译、构建并可以在浏览器中看到。这里没问题 但是当我们尝试使用karma和jasmine运行测试用例时,我们得到了这个错误 FAILED TESTS: XXXXXXComponent :heavy_multiplication_x: Should Match Current Tab as 1 Chrome 55.0.2883 (Mac OS X 10.10.5) Error: Template parse errors: Can'

我们的项目结构如下:

我们的项目成功编译、构建并可以在浏览器中看到。这里没问题

但是当我们尝试使用
karma和jasmine运行测试用例时,我们得到了这个错误

FAILED TESTS:
 XXXXXXComponent
   :heavy_multiplication_x: Should Match Current Tab as 1
     Chrome 55.0.2883 (Mac OS X 10.10.5)
   Error: Template parse errors:
   Can't bind to 'formgroup' since it isn't a known property of 'form'. ("                <div class="tab-pane active" role="tabpanel" id="step1">
                                           <form novalidate [ERROR ->][formgroup]="step1Form" class="height-full" >
                                               <div class="row" id="tabHeader1">
             "): XXXXXXComponent@38:27
   Can't bind to 'dividerColor' since it isn't a known property of 'md-input'.
   1. If 'md-input' is an Angular component and it has 'dividerColor' input, then verify that it is part of this module.
   2. If 'md-input' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message.
    ("ass = "col-md-8 col-lg-8 col-sm-8">
                                                           <div class="form-group">
                                                               <md-input [ERROR ->]dividerColor="{{getDividerColor(lexiconTitle)}}" placeholder="Lexicon Title" formControlName="lexicon"): XXXXXXComponent@52:25
   Can't bind to 'ngModel' since it isn't a known property of 'md-input'.
   1. If 'md-input' is an Angular component and it has 'ngModel' input, then verify that it is part of this module.
   2. If 'md-input' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message.
    ("olor="{{getDividerColor(lexiconTitle)}}" placeholder="Lexicon Title" formControlName="lexiconTitle" [ERROR ->][(ngModel)]="blogModel.lexiconTitle" name="lexiconTitle" class="md-form-control" required>
                                           "):
我们已经安装了所有最新版本的软件包

"karma": "^1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-coverage": "^1.1.1",
"karma-jasmine": "^1.0.2",
"karma-remap-coverage": "^0.1.4",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "2.0.1",
"webpack": "2.2.0",
"webpack-dev-middleware": "^1.9.0",
"webpack-dev-server": "2.2.0",
"webpack-dll-bundles-plugin": "^1.0.0-beta.5",
"webpack-md5-hash": "~0.0.5",
"webpack-merge": "~2.4.0"
试验台设置:

TestBed.configureTestingModule({
    imports: [ReactiveFormsModule, FormsModule],
    declarations: [ XXXXComponent ], // declare the test component
});

感谢您对解决此问题的任何帮助

您的错误是因为您需要在md输入容器标记中使用dividerColor指令,而不是md输入。

这很奇怪——这两个错误似乎都是您希望在运行时发现的错误。您提到它是编译和运行的——在手动测试期间是否呈现了有问题的视图?html绑定在错误中无效。您是如何在测试中获得XXXXComponent实例的(或者您现在还没有获得)?
TestBed.configureTestingModule({
    imports: [ReactiveFormsModule, FormsModule],
    declarations: [ XXXXComponent ], // declare the test component
});