0.0.2 • Published 7 years ago

angular-basic-calculator v0.0.2

Weekly downloads
3
License
ISC
Repository
-
Last release
7 years ago

1. Intro

Performs basic mathematical operations:

  • summation +
  • subtraction -
  • multiplication *
  • division /
  • exponentiation ^
  • parentheses (...)

API:

  • isExpressionValid(string) boolean
  • parseAndEvaluate(string) number

2. Usage

  • import AngularBasicCalculatorModule into a Single Page App
/*
  src/app/app.module.ts
*/

import { AngularBasicCalculatorModule } from 'angular-basic-calculator';

@NgModule({
  imports: [
    ...,
    AngularBasicCalculatorModule
  ],
  ...
})
export class AppModule { }
  • inject AngularBasicCalculatorService into a component/service/pipe
constructor(private _angularBasicCalculatorService: AngularBasicCalculatorService) {
  this._angularBasicCalculatorService.parseAndEvaluate('1 + 1'); // = 2
}

3. Demo in a Single Page App

  • See usage in the demo app

  • See live demo of the demo app on CodePen

0.0.2

7 years ago

0.0.1

7 years ago