我正在尝试跟随ng-bootstrap入门,它说我应该导入:
从‘@ng-bootstrap/ng-bootstrap’导入{NGB_DIRECTIVES,NGB_PRECOMPILE};
然后在app.component.ts中请求预编译: NGB_PRECOMPILE
我在Visual Studio代码中收到一个很大的红色错误,说
ts
类型'{选择器:字符串;指令:( typeof NgbAccordion | typeof NgbPanel |typeof NgbPanelTitle)][...‘不能赋值给'{选择器?:字符串;输入?:string[];输出?:string[];属性?:string[];事件?:strin...‘类型的参数。对象文本只能指定已知的属性,并且“”预编译“”不存在于类型“”{选择器?:字符串;输入?:字符串;输出?:string[];属性?:string[];事件?:字符串...“”中。
所以
在检查应用程序时,我发现加载资源@ ng-bootstrap /ng-bootstrap失败,但我在node_modules中看到了一个文件夹@ng-bootstrap和一个名为ng-bootstrap的子文件夹。
我很困惑,因为它似乎一方面告诉我它找到了它,但它是错误的类型,但另一方面它又说它根本找不到它。
我在装有npm 3.10.6的windows10上尝试了这一点。
这是一个简单的问题吗?
import {Component} from 'angular2/core';
import {NGB_DIRECTIVES, NGB_PRECOMPILE} from '@ng-bootstrap/ng-bootstrap';
import {TestComponent} from './test.component';
@Component({
selector: 'my-app',
directives: [ NGB_DIRECTIVES, TestComponent],
precompile: [ NGB_PRECOMPILE ], //<-- doesn't like this one
template: `<h1>My new App platform</h1>
<test></test>
`
})
export class AppComponent { } 发布于 2016-08-05 22:58:01
这似乎是一个版本问题。在rc4中添加了预编译
通过这个提交: github.com/angular/angular/commit/6c5b653
https://stackoverflow.com/questions/38792108
复制相似问题