2016-06-11 232 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