What is angular-resizable-element?
The angular-resizable-element package allows you to add resizable functionality to elements in your Angular applications. It provides a simple and flexible way to make any element resizable by dragging its edges or corners.
What are angular-resizable-element's main functionalities?
Basic Resizable Element
This feature allows you to make a basic element resizable by specifying the handles (e.g., 'right', 'bottom', 'corner') that can be dragged to resize the element.
<resizable [rzHandles]="['right', 'bottom', 'corner']">
<div class="box">
Resizable Element
</div>
</resizable>
Resizable with Minimum and Maximum Dimensions
This feature allows you to set minimum and maximum dimensions for the resizable element, ensuring that it cannot be resized beyond the specified limits.
<resizable [rzHandles]="['right', 'bottom', 'corner']" [rzMinWidth]="100" [rzMinHeight]="100" [rzMaxWidth]="500" [rzMaxHeight]="500">
<div class="box">
Resizable Element with Constraints
</div>
</resizable>
Resizable with Aspect Ratio
This feature allows you to maintain the aspect ratio of the resizable element, ensuring that the width and height are resized proportionally.
<resizable [rzHandles]="['right', 'bottom', 'corner']" [rzAspectRatio]="true">
<div class="box">
Resizable Element with Aspect Ratio
</div>
</resizable>
Other packages similar to angular-resizable-element
angular-gridster2
angular-gridster2 is a package that provides a grid layout system for Angular applications, allowing you to create resizable and draggable grid items. It offers more advanced grid-based layout features compared to angular-resizable-element, making it suitable for complex dashboard layouts.
ngx-resizable
ngx-resizable is another Angular package that provides resizable functionality for elements. It offers similar features to angular-resizable-element, such as customizable handles and constraints, but with a different API and implementation.
angular-split
angular-split is a package that allows you to create resizable split views in Angular applications. It is specifically designed for creating resizable panels or splitters, making it a good choice for applications that require a split view layout.
angular resizable element
Demo
https://mattlewis92.github.io/angular-resizable-element/demo/
Table of contents
About
An angular 4.0+ directive that allows an element to be dragged and resized
Installation
Install through npm:
npm install --save angular-resizable-element
Then use it in your app like so:
import {Component} from '@angular/core';
import {ResizeEvent} from 'angular-resizable-element';
@Component({
selector: 'demo-app',
styles: [`
mwlResizable {
box-sizing: border-box; // required for the enableGhostResize option to work
}
`],
template: `
<div
mwlResizable
[enableGhostResize]="true"
[resizeEdges]="{bottom: true, right: true, top: true, left: true}"
(resizeEnd)="onResizeEnd($event)">
</div>
`
})
export class MyComponent {
onResizeEnd(event: ResizeEvent): void {
console.log('Element was resized', event);
}
}
import {NgModule} from '@angular/core';
import {ResizableModule} from 'angular-resizable-element';
@NgModule({
declarations: [MyComponent],
imports: [ResizableModule],
bootstrap: [MyComponent]
})
class MyModule {}
You may also find it useful to view the demo source.
Usage without a module bundler
<script src="node_modules/angular-resizable-element/angular-resizable-element.js"></script>
<script>
// everything is exported on the angularResizableElement namespace
</script>
Documentation
All documentation is auto-generated from the source and can be viewed here:
https://mattlewis92.github.io/angular-resizable-element/docs/
Development
Prepare your environment
- Install Node.js and NPM (should come with)
- Install local dev dependencies:
npm install
while current directory is this repo
Development server
Run npm start
to start a development server on port 8000 with auto reload + tests.
Testing
Run npm test
to run tests once or npm run test:watch
to continually run tests.
Release
npm run release
License
MIT