1.2.0 • Published 8 years ago
termlex-ng v1.2.0
Termlex Angular Module
Demo
https://termlex.github.io/termlex-ng-module/
Table of contents
About
An Angular 2+ module for Termlex
Installation
Install through npm:
npm install --save termlex-ng
or
yarn add termlex-ng
Then include in your apps module:
import { NgModule } from '@angular/core';
import { TermlexModule } from 'termlex-ng';
// Provide config
const apiConfig = {
token: 'xxxxxxxxxxx',
url: 'https://v1.termlex.com',
resultOpts: {
maxInstantResultsSize: 10, // max number of instant results
conceptType: "919191919191441993", // conceptId of SNOMED CT top level concept - returns concepts in all hierarchies
maxResultsSize: 100
};
};
@NgModule({
imports: [
TermlexModule.forRoot(apiConfig)
]
})
export class MyModule {}
Finally use in one of your apps components:
import { Component } from '@angular/core';
import { TermlexService } from 'termlex-ng';
@Component({
template: '<div>hello-world</div>'
})
export class MyComponent {
constructor(private termlexService: TermlexService) { }
...
doSearch(query: string) {
let results = [];
results = termlexService.matches(query, null);
console.log('Results : ', results);
}
}
You may also find it useful to view the demo source.
Usage without a module bundler
<script src="node_modules/termlex-ng/bundles/termlex-ng.umd.js"></script>
<script>
// everything is exported termlexNg namespace
</script>
Documentation
All documentation is auto-generated from the source via compodoc and can be viewed here: https://termlex.github.io/termlex-ng-module/docs/
Development
Prepare your environment
Development server
Run yarn start
to start a development server on port 8000 with auto reload + tests.
Testing
Run yarn test
to run tests once or yarn run test:watch
to continually run tests.
Release
- Bump the version in package.json (once the module hits 1.0 this will become automatic)
yarn run release
License
MIT