ts-angular-components
v3.0.24
Published
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.2.3.
Downloads
61
Readme
TsAngularComponents
This project was generated with Angular CLI version 6.2.3.
Development server
Run ng serve
for a dev server. Navigate to http://localhost:4200/
. The app will automatically reload if you change any of the source files.
Build
Run ng build
to build the project. The build artifacts will be stored in the dist/
directory. Use the --prod
flag for a production build.
Creating a component
1. ng generate module components/ts-[component-name]
2. ng generate component components/ts-[component-name]
3. add component to exports and custom element injector in the module
```javascript
@NgModule({
imports: [
CommonModule
],
declarations: [TsComponentClassName],
exports: [TsComponentClassName],
entryComponents: [TsComponentClassName]
})
export class TsModuleName {
constructor(private injector: Injector) {
const el = createCustomElement(TsComponentClassName, { injector });
customElements.define('ts-component-selector', el);
}
ngDoBootstrap() { }
};
```
3. add module to 'public_api.ts'
```javascript
export * from './src/app/components/ts-[component-name]/ts-component-name.module';
```
Publish to NPM
1. make sure you have logged in with correct Travelsmart npm credentials. Refer to npm docs
2. upadete `version` in package.json
3. run `npm run packagr`
4. run `cd dist`
5. run `npm publish`