ngx-voicely
v0.0.3
Published
Highly customizable review collection system for Angular applications
Maintainers
Readme
NgxVoicely
A highly customizable review collection system for Angular applications.
🌟 Features
- Star Rating: Allow users to rate experiences on a scale of 1-5.
- Text Feedback: Collect detailed feedback from users.
- Image Upload: Let users attach images to their reviews.
- Categories: Group reviews by predefined categories.
- Tags: Add keywords and tags to reviews.
- Custom Elements: Add dropdowns, checkboxes, and other custom fields to your review form.
- Fully Configurable: Turn features on/off according to your needs.
📦 Installation
Install the package via npm:
npm install ngx-voicely --save🚀 Usage
Basic Setup
Import the Module
Add the module to your
app.module.ts:import { NgxReviewSystemModule } from 'ngx-voicely'; @NgModule({ imports: [ // ... other imports NgxReviewSystemModule ], }) export class AppModule { }For standalone components:
import { NgxReviewSystemComponent } from 'ngx-voicely'; @Component({ // ... other component metadata imports: [ // ... other imports NgxReviewSystemComponent ], })Add the Component
Insert the component into your template:
<ngx-review-system [config]="reviewConfig" (reviewSubmitted)="onReviewSubmitted($event)"> </ngx-review-system>Configure the Component
Define the configuration in your component class:
import { Component } from '@angular/core'; import { NgxReviewSystemService, ReviewConfig, ReviewData } from 'ngx-voicely'; @Component({ // ... component metadata }) export class MyComponent { reviewConfig: ReviewConfig = { showRating: true, showTextFeedback: true, enableImageUpload: true, showCategories: true, categories: [ { id: 'product', name: 'Product Quality' }, { id: 'service', name: 'Customer Service' } ], enableTags: true, availableTags: ['Excellent', 'Good', 'Average', 'Poor'], allowCustomTags: true }; constructor(private reviewService: NgxReviewSystemService) {} onReviewSubmitted(review: ReviewData): void { console.log('Review submitted:', review); // Process the review data } }
⚙️ Configuration Options
The review system can be extensively customized through the ReviewConfig interface:
interface ReviewConfig {
showRating: boolean; // Enable/disable the star rating component
showTextFeedback: boolean; // Enable/disable the text feedback area
enableImageUpload: boolean; // Enable/disable image upload functionality
maxImageCount?: number; // Maximum number of images allowed to upload
showCategories: boolean; // Enable/disable category selection
categories?: ReviewCategory[]; // List of available categories for selection
enableTags: boolean; // Enable/disable tagging functionality
availableTags?: string[]; // Predefined tags that users can select from
allowCustomTags?: boolean; // Allow users to create custom tags
showCustomElements?: boolean; // Enable/disable additional customizable elements
customElements?: CustomElement[]; // List of custom elements to display
onSubmit?: (review: ReviewData) => void; // Callback function when a review is submitted
}🛠️ Service Helpers
The library includes the NgxReviewSystemService that provides helper methods:
- Create Config: Generate a configuration with default values.
- Store Reviews: Save reviews in the service.
- Get Reviews: Retrieve all reviews as an Observable.
- Average Rating: Calculate the average rating from all reviews.
- Filter Reviews: Filter reviews by rating or tags.
🎨 Styling
The component comes with default styling, but you can override it in your global CSS or component styles to match your application's design.
📄 License
MIT
Feel free to reach out with any questions or feedback! Enjoy using NgxVoicely! 😊
