An Angular service wrapper for Float Toolkit
To add Float Toolkit to your Angular app, you have two options:
Run this command:
ng add @float-toolkit/angular
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 {}
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]);
}
}
Need help using Float Toolkit? Don't hesitate to reach out on GitHub Discussions!
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.