UNPKG

@fdot/angular-dotcodes

Version:

`npm install @fdot/angular-dotcodes --save`

58 lines (46 loc) 1.79 kB
# @fdot/angular-dotcodes ## Installation `npm install @fdot/angular-dotcodes --save` ### Setup ```javascript import { NgModule } from '@angular/core'; import { AngularDotcodesModule, Config } from '@fdot/angular-dotcodes'; @NgModule({ declarations: [ ], imports: [ // Add the import for the Angular Dotcodes Module AngularDotcodesModule.forRoot(new Config('Host Url Goes Here', 'Api Key Goes Here',false,'select')), ], providers: [], bootstrap: [AppComponent] }) export class AppModule { } ``` #### Module Config Options * host - The url for the dotcodes api the module will use * apiKey - The api key for the api call. * useDefaultSelect - Indicates if the select should have a default no value option * defaultSelectText - The text for the default option ### Dotcodes Select Component ```html <fdot-dotcodes-select column="ST_CD" (selectedDotcode)="codeChanged($event)"> </fdot-dotcodes-select> ``` #### Inputs * column - The column for the dotcodes being looked up. * value - The code value that should be initial selected. * disabled - If the select should be disabled. * useDefaultSelect - Indicates if the select should have a default no value option * defaultSelectText - The text for the default option #### Outputs * selectedDotcode - The dotcode that is selected ### Dotcode Pipe ```html {{val | dotcode:'ST_CD' | async}} ``` ### AngularDotcodesService A service is also included in the module for making your own calls for custom components or services. ##### Methods * `GetCode(column: string, codeValue: string): Observable<Dotcode>` * `GetCodes(column: string): Observable<DotCode[]>` * `GetRelatedCodes(column: string, codeValue: string, relatedCode: string): Observable<RelatedCode[]>`