2016-06-20 53 views
0

我尝试使用NG2-引导提示组件,但每次我得到进口NG2的自举(NG2 RC2 - bootstrap3)

GET HTTP:/example.com/node_modules/ng2-bootstrap/ng2 -bootstrap 404(未找到)

我尝试:

import {TOOLTIP_DIRECTIVES} from '../../../ng2-bootstrap'; 
import {TOOLTIP_DIRECTIVES} from 'node_modules/ng2-bootstrap/ng2-bootstrap'; 
import {TOOLTIP_DIRECTIVES} from 'ng2-bootstrap/ng2-bootstrap'; 

最后一个与SystemJS配置从this post

map { 
    ... 
    'ng2-bootstrap/ng2-bootstrap': 'node_modules/ng2-bootstrap/ng2-bootstrap', 
    ... 
} 

我的组件看起来像:

import {Component, Input} from '@angular/core'; 
import {CORE_DIRECTIVES, FORM_DIRECTIVES} from '@angular/common'; 
import {TOOLTIP_DIRECTIVES} from 'ng2-bootstrap/ng2-bootstrap'; 

@Component({ 
    selector: 'check-type', 
    templateUrl: 'app/task/overview/check-type/check-type.html', 
    directives: [TOOLTIP_DIRECTIVES, CORE_DIRECTIVES, FORM_DIRECTIVES], 
    changeDetection: ChangeDetectionStrategy.OnPush 
}) 

export class CheckType { 
    public mytooltip:string = "My Tooltip"; 
} 

我用Angular2 RC2,NG2的自举1.0.17和3.3.6引导。 检查 - NG2-bootstrap.min.js在指数HTML 检查 - moment.js包括在SystemJS配置 入住插入映射

+0

ng2-bootstrap,被重命名为ngx-bootstrap – valorkin

回答

0

线索是使用

import {TOOLTIP_DIRECTIVES} from 'ng2-bootstrap/ng2-bootstrap'; 

无需在入境所述SystemJS配置的地图对象,并且还以除去

format: 'register'

条目(I置于它作为N2-自举的GIT页上所描述的)或更换与

format: 'cjs'

(我会很高兴,如果有人可以解释,为什么在导入以这种方式工作。就像现在这样,它有效,但对我来说没有意义。我不明白SystemJS在节点文件夹中搜索ng2-bootstrap的位置,而不是只搜索ng2-bootstrap文件夹。)