TS Compile静默失败

时间:2016-06-11 06:52:54

标签: typescript angular typescript1.8

我在ng2-semantic-ui版本package.json中加入了^0.2.3,最初我的组件看起来像这样:

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_DIRECTIVES添加到directives就会出错。 但是,我没有从tsc获得任何编译错误 - 实际上错误级别(在Windows上运行节点)为0并且它既不打印错误也不警告,并且所有其他TS文件都已正确编译。

正确编译其他文件,而不是此文件。我忽略了什么吗?我已经在systemjs配置中添加了一个适当的map来加载它,但我不认为它会发挥作用,除非它在浏览器中加载。

1 个答案:

答案 0 :(得分:0)

我通过将semantic.min.css保存在资源文件夹下,在我的non angular-cli项目中使用了semantic-ui。我不需要配置任何package.json或system.config.js。并在index.html中显示路径。这是一个截图

enter image description here

现在在我需要使用semantic-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

相关问题