简体   繁体   English

未生成Index.ts

[英]Index.ts not being generated

I m generating a component but it wont generate index.ts file . 我正在生成组件,但不会生成index.ts文件。 I am using the following command 我正在使用以下命令

ng g c Databinding 

whereas i am running windows with node 6.9.1 and angular-cli version 1.0.0 beta.20-4 while my app.component.ts has following code 而我正在使用node 6.9.1angular-cli version 1.0.0 beta.20-4运行Windows,而我的app.component.ts具有以下代码

import { Component } from '@angular/core';
import { DatabindingComponent } from './databinding/databinding.component';
//./databinding/databinding.component is a replacement for ./databinding as     index.ts didn't generated. 
@Component({
  selector: 'app-root',
  template: `
  <h1>{{title}}</h1>
 <app-databinding></app-databinding>
  `,
  directives : [DatabindingComponent];
})
export class AppComponent {
    title = 'I changed it!';
}

Edit, Following on Angular github , i found out that index.ts is not a part of angular generate, so my question is how to use directives now? 编辑,接着在Angular github上 ,我发现index.ts不是angular generate的一部分,所以我的问题是现在如何使用指令?

The index.ts file inside the folder is used to exports the classes you want to show, like: 文件夹中的index.ts文件用于导出要显示的类,例如:

import { Component1, Component2 } from './databinding';

They were removed from angular-cli since the introduction of module . 模块引入以来, 它们已从angular-cli中删除 It's now used to expose the API of your module (inside the app folder). 现在,它用于公开模块的API(在app文件夹内)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM