This is Angular component for searching in company catalog.
Example:
In NgModule (xxx.module.ts):
import { CompanyCatalogModel } from 'kros-website-company-catalog';
...
imports: [
...
CompanyCatalogModule.forRoot("API_URL") // Where API_URL is Url for searching api
],
In template (xxx.component.html):
<kros-website-company-catalog [name]="name"
(selectCompany)="onSelectCompany($event)">
<label [for]="name">
Company name*
</label>
<input [id]="name"
#searchInput
#searchModel="ngModel"
type="text"
name="search-text"
autocomplete="off"
class="form-control textbox"
[class.invalid-textbox]="isInvalid(searchModel)"
[(ngModel)]="model.billingAddress.recipient"
required />
</kros-website-company-catalog>
In component (xxx.component.ts):
import { CompanyCatalogModel } from 'kros-website-company-catalog';
...
onSelectCompany(companyCatalogModel: CompanyCatalogModel) {
this.model.billingAddress.recipient = companyCatalogModel.name;
this.model.registrationId = companyCatalogModel.registrationId;
this.model.taxId = companyCatalogModel.taxId;
this.model.vatId = companyCatalogModel.vatId;
this.model.billingAddress.street = companyCatalogModel.street;
this.model.billingAddress.town = companyCatalogModel.town;
this.model.billingAddress.postalCode = companyCatalogModel.postCode;
}
Created by this tutorial: https://github.com/angular/angular-cli/wiki/stories-create-library
Tutorial (How to Publish & Update a Package): https://docs.npmjs.com/getting-started/publishing-npm-packages