npm.io
1.0.0 • Published 3 years ago

@float-toolkit/angular

Licence
Apache-2.0
Version
1.0.0
Deps
4
Size
47 kB
Vulns
0
Weekly
0

An Angular service wrapper for Float Toolkit

Get started

Installation

To add Float Toolkit to your Angular app, you have two options:

Install using the Angular CLI

Run this command:

ng add @float-toolkit/angular
Install manually

Run this command:

npm install @float-toolkit/angular

Then, import the FloatToolkitModule into any module where you want to use the FloatToolkit service.

import { FloatToolkitModule } from "@float-toolkit/angular";

@NgModule({
	imports: [
		// ...
		FloatToolkitModule,
	],
})
export class AppModule {}
Usage

The package exports an Angular injectable (service) called FloatToolkit. It implements an output state property, as well as FloatToolkit methods that also serve as setters for the output.

import { Component, Input, OnInit } from "@angular/core";
import { FloatToolkit } from "@float-toolkit/angular";

@Component({
	// ...
	template: ` <span class="number">{{ output }}</span> `,
})
export class SumComponent implements OnInit {
	constructor(private ft: FloatToolkit) {}

	@Input() x = 0;
	@Input() y = 0;

	get output(): number {
		return this.ft.output;
	}

	ngOnInit(): void {
		this.ft.add([this.x, this.y]);
	}
}

Support

Need help using Float Toolkit? Don't hesitate to reach out on GitHub Discussions!

Contributing

Before creating an issue, please consider the following:

  • Read the documentation and this file carefully to make sure the error is actually a bug and not a mistake of your own.
  • Make sure the issue hasn't already been reported or suggested.
  • After following these steps, you can file an issue using one of our templates. Please make sure to follow our Code of Conduct.
  • If you wish to submit a pull request alongside your issue, please follow our contribution guidelines.