DNext Angular Directives¶
A collection of useful Angular directives for common UI interactions and behaviors.
Installation¶
Available Directives¶
TrimSpaceDirective¶
Prevents leading spaces and normalizes multiple spaces in input fields.
Features: - Prevents leading spaces - Replaces multiple spaces with a single space - Trims trailing spaces on blur - Works with both template-driven and reactive forms
NoECharDirective¶
Prevents the 'e' character from being entered in number input fields.
Features: - Prevents 'e' and 'E' characters in number inputs - Useful for numeric fields where scientific notation is not desired
StopPropagationDirective¶
Stops click event propagation to parent elements.
Features: - Prevents click events from bubbling up to parent elements - Useful for nested clickable elements
ScrollbarDirective¶
A wrapper for Perfect Scrollbar with enhanced functionality.
Features: - Custom scrollbar styling - Scroll position management - Programmatic scrolling methods - Responsive updates - Configurable options
ScrollTopDirective¶
Automatically scrolls element to top on route changes.
Features: - Automatic scroll to top on navigation - Works with Angular router - No configuration needed
API Reference¶
ScrollbarDirective¶
Inputs¶
scrollbar: boolean- Enable/disable the scrollbarscrollbarOptions: PerfectScrollbar.Options- Configuration options
Methods¶
update()- Updates scrollbardestroy()- Destroys scrollbar instancescrollTo(x: number, y?: number, speed?: number)- Scrolls to specific coordinatesscrollToElement(selector: string, offset?: number, ignoreVisible?: boolean, speed?: number)- Scrolls to elementscrollToTop(offset?: number, speed?: number)- Scrolls to topscrollToBottom(offset?: number, speed?: number)- Scrolls to bottomscrollToLeft(offset?: number, speed?: number)- Scrolls to leftscrollToRight(offset?: number, speed?: number)- Scrolls to right
Dependencies¶
- @angular/core: ^18.0.0
- @angular/common: ^18.0.0
- @angular/cdk: ^18.0.0
- perfect-scrollbar: ^1.5.5
- rxjs: ^7.0.0
Browser Support¶
- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
License¶
DNext PiAGroup