2016-06-20 57 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文件夾。)