我创建了一个 Angular 库,但我想导出一个我的应用程序可以使用的模型。我怎样才能做到这一点 ?
例如 :
我的图书馆
库-model.ts
export class LibraryModel{
//some model data
}
Run Code Online (Sandbox Code Playgroud)
my-library.component.ts
import { Component, OnInit, Input } from '@angular/core';
//some imports
@Component( {
selector: '...',
templateUrl: '...',
styleUrls: [...]
} )
export class MyLibraryComponent implements OnInit {
@Input() libInputData: LibraryModel;
// some other codes
}
Run Code Online (Sandbox Code Playgroud)
my-library.module.ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { MyLibraryComponent} from './my-library.component';
import { LibraryModel} from './library-model';
@NgModule( {
declarations: [MyLibraryComponent, LibraryModel],
imports: [ …Run Code Online (Sandbox Code Playgroud)