1.0.2 • Published 1 year ago
ng-tagcanvas v1.0.2
NgTagCanvas
An Angular component wrapper for goat1000's HTML5 canvas tag cloud, compatible with Angular version 12 and upward.
Installation
- Install
ng-tagcanvasfrom npm registry
If using npm:
npm install ng-tagcanvasIf using yarn:
yarn add ng-tagcanvas- Then add
TagCanvasModuleto yourAppModule
import { TagCanvasModule } from 'ng-tagcanvas';
...
@NgModule({
...
imports: [
TagCanvasModule.forRoot()
]
})
export class AppModule {}Usage example
<ng-tag-canvas [options]="{ dragControl: true, weight: true }">
<a ngTag [weight]="40">Go</a>
<a ngTag [weight]="99">Typescript</a>
<a ngTag [weight]="50">Java</a>
<a ngTag [weight]="60">Python</a>
<a ngTag [weight]="80">Rust</a>
</ng-tag-canvas>Demo
https://luchariman.github.io/ng-tagcanvas
Changes compared to the version 0.x:
- Breaking:
TagCanvasModulehas to be loaded as a singleton by usingforRoot(). It accepts an optionalTagCanvasOptionsfor configuring global options common to all instances of TagCanvas. - Breaking:
[tags]attribute is no longer supported by<ng-tag-canvas>component. Instead, tags are added as content of the<ng-tag-canvas>component, and such as with the native TagCanvas, they have to be an<a>element. This change allows the support of images as content. - Feature: The
ngTagdirective can be used on tag items, which disables the default click action on theaelement. It also accepts aweightinput which gets applied whenoptions.weightistrue.