0.0.11 • Published 6 years ago

angular-flamelink-text-search v0.0.11

Weekly downloads
17
License
-
Repository
-
Last release
6 years ago

AngularFlamelinkTextSearch

An angular wrapper service to call Flamelink Firebase search function.

Dependencies

Note: Before installing this library to your app's frontend, make sure you've added the search function to Firebase Functions, as described here: https://www.npmjs.com/package/flamelink-text-search

Installation

Run npm i -s angular-flamelink-text-search.

Then, import AngularFlamelinkTextSearchModule to your app.module.ts:

import { AngularFlamelinkTextSearchModule } from 'angular-flamelink-text-search';

@NgModule({
	imports: [
		AngularFlamelinkTextSearchModule
	]
})

Usage

page.component.ts

import { AngularFlamelinkTextSearch } from 'angular-flamelink-text-search';

@Component({
	// ...
})
export class PageComponent implements OnInit {

	public searchResults: {}[] = [];

	constructor(
		private flamelinkSearch: AngularFlamelinkTextSearch
	) { }

	ngOnInit() {
		/*
		This is the name of the function you created in Firebase.
		If not specified here, it defaults to 'search'.
		/*
		this.flamelinkSearch.functionName = 'search';

		this.flamelinkSearch.search({
			query: 'YOUR SEARCH QUERY',
			start: 1 // Defaults to 1,
			limit: 50 // Defaults to 20,
			schemas: [
				{ schemaKey: 'reports' },
				{ schemaKey: 'articles' },
			]
		}).then(result => {
			this.searchResults = result.data;
		});
	}

}

page.component.html

<div *ngFor="let result of searchResults | async">
	{{ result.title }}
</div>
0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago