-1
this error should be simple but I’m new with angular
I believe I must make few changes to that code
Code of the Service below:
import { Grade } from './../calculator/calculator.model';
import { Injectable } from '@angular/core';
import { Input } from '@angular/core';
@Injectable({
providedIn: 'root',
})
export class ResultService {
@Input()
grade: Grade = {
name: '',
grade1: null,
grade2: null,
grade3: null,
};
calcGrade(): void {
let nota1 = this.grade.grade1 * 0.25;
let nota2 = this.grade.grade2 * 0.25;
let nota3 = this.grade.grade3 * 0.5;
let conta = nota1 + nota2 + nota3;
if (conta < 6.2) {
console.log(
`o aluno ${this.grade.name} foi reprovado com a nota ${conta}`
);
}
if (conta >= 6.2) {
console.log(
`o aluno ${this.grade.name} foi aprovado com a nota ${conta}`
);
}
}
constructor() {}
}
when I click on a button I want to call another component with the data typed in another component
HTML code below:
or I can put the service code inside ts
<div class="container">
<div class="content">
<h1>
o aluno {{ grade.name }} tirou {{ grade.grade1 }} na primeira prova e
{{ grade.grade2 }} na segunda prova
</h1>
</div>
</div>