2016-06-11 235 views
0

我已經列入我package.json^0.2.3版本ng2-semantic-ui,和我原本看上去像這樣的組件:TS編譯失敗默默

import {Component} from '@angular/core'; 
import {Title} from '@angular/platform-browser'; 

import {HomeTreeComponent} from './tree'; 
import {UserPhotoComponent} from "./userphoto.component"; 

@Component({ 
    templateUrl: 'app/home/index.html', 
    providers: [Title], 
    directives: [HomeTreeComponent, UserPhotoComponent] 
}) 
export class HomeIndexComponent { 
    constructor(title: Title) { 
     title.setTitle('Welcome'); 
    } 
} 

哪些好聽編譯並給出了一個JavaScript文件如預期。但只要我加入import {TAB_DIRECTIVES} from "ng2-semantic-ui/ng2-semantic-ui";進口和TAB_DIRECTIVESdirectives事情出錯了。 但是,我沒有從tsc收到任何編譯錯誤 - 事實上errorlevel(windows上的運行節點)爲0,它不會打印錯誤或警告,並且所有其他TS文件都可以正確編譯。

其他文件編譯正確,只是沒有這個文件。我忽略了什麼?我已經在systemjs配置文件中加入了一個合適的map來加載它,但我認爲這並不會起作用,除非它在瀏覽器中加載。

+0

您是否嘗試過除ng2-semantic-ui以外的其他TAB_DIRECTIVES? –

+0

是的,一切似乎都給出了同樣的問題。 – fredrik

+0

我在我的angular2項目中使用了語義ui,但不是ng2-semantic-ui。所以,如果你想,我可以分享我的工作與semantic-ui :) –

回答

0

我通過將semantic.min.css放在資源文件夾下,在我的非angular-cli項目中使用了semantic-ui。我不需要配置任何package.json或system.config.js。並在index.html中顯示路徑。這裏去截圖

enter image description here

現在在我的分量,我需要使用語義UI,我像這樣的代碼

@Component({ 
    selector: 'app-semantic', 

    template: ` 
    <div class="ui tab" data-tab="first"> 
      My First Tab 
    </div> 
    <div class="ui tab" data-tab="other"> 
      Other content 
    </div> 
    ` 
}) 

我的項目的角度版本是2.0.0,RC.1

+0

但該標籤是在語義上的JavaScript組件 - 如果我沒有弄錯,所以我不能真正看到這會按需要工作。 – fredrik