| 12345678910111213141516171819202122232425 |
- import { Component } from '@angular/core';
- import {CalculatorComponent} from "./calculator/calculator.component";
- import {CalculatorService} from "./calculator.service";
- @Component({
- selector: 'app-root',
- templateUrl: './app.component.html',
- styleUrls: ['./app.component.css']
- })
- export class AppComponent {
- title = 'Simple Calculator';
- calculators : number[] = [0] ;
- numCreated: number = 1;
- addCalculator() {
- let val = ++this.numCreated;
- this.calculators.push(val);
- }
- removeCalculator(val : number) {
- let index = this.calculators.indexOf(val);
- this.calculators.splice(index, 1);
- }
- }
|