ng-bootstrap NGB_PRECOMPILE上的预编译错误 [英] precompile error on ng-bootstrap NGB_PRECOMPILE

查看:65
本文介绍了ng-bootstrap NGB_PRECOMPILE上的预编译错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正尝试遵循 ng-bootstrap ,它说我应该导入:

I'm trying to follow along with the ng-bootstrap getting started, it says I should import:

从'@ ng-bootstrap/ng-bootstrap'导入{NGB_DIRECTIVES,NGB_PRECOMPILE};

import {NGB_DIRECTIVES, NGB_PRECOMPILE} from '@ng-bootstrap/ng-bootstrap';

然后请求预编译:app.component.ts中的[NGB_PRECOMPILE]

then request precompile: [ NGB_PRECOMPILE ] in the app.component.ts

我在Visual Studio Code中遇到一个大红色错误,说

I'm getting a big red error in Visual Studio Code, saying

[ts]

'{选择器类型:字符串;指令:(((((typeof NgbAccordion | typeof NgbPanel | typeof NgbPanelTitle)[...'不可分配给类型'{选择器?:字符串;输入?:string [];输出?:string [];属性?: string []; events ?: strin ...'. 对象文字只能指定已知的属性,并且'precompile'在类型'{选择器?:字符串;'中不存在.输入?:字符串[];输出?:string [];属性?:string [];事件?:strin ...'.

Argument of type '{ selector: string; directives: (((typeof NgbAccordion | typeof NgbPanel | typeof NgbPanelTitle)[...' is not assignable to parameter of type '{ selector?: string; inputs?: string[]; outputs?: string[]; properties?: string[]; events?: strin...'. Object literal may only specify known properties, and 'precompile' does not exist in type '{ selector?: string; inputs?: string[]; outputs?: string[]; properties?: string[]; events?: strin...'.

所以

并检查应用程序,我发现无法加载资源@ ng-bootstrap/ng-bootstrap,但是我在node_modules中看到一个文件夹@ ng-bootstrap和一个名为ng-bootstrap的子文件夹.

and inspecting app I see failed to load resource @ng-bootstrap/ng-bootstrap, but I see a folder @ng-bootstrap and a sub folder named ng-bootstrap in node_modules.

我很困惑,因为它似乎一方面告诉我它找到了它,但是它是错误的类型,但另一方面却说它根本找不到.

I'm confused because it seems to be telling me on one hand it found it, but it's the wrong type, but on the other it's saying it can't find it at all.

我正在Windows 10上使用npm 3.10.6进行尝试.

I'm trying this on windows 10 with npm 3.10.6.

这是一个简单的问题吗?

Is this a simple issue?

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 { } 

推荐答案

这似乎是一个版本问题.预编译已添加到rc4

This seems like a version issue. precompile was added in rc4

通过此提交:github.com/angular/angular/commit/6c5b653

via this commit: github.com/angular/angular/commit/6c5b653

这篇关于ng-bootstrap NGB_PRECOMPILE上的预编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆