You should use the $document service instead of the default document object
30document.getElementById('vote').addEventListener('input', () => {
31 const vote = parseFloat(document.getElementById('vote').value);
32 if (vote < 0) {
33 document34 .getElementById('vote')35 .setCustomValidity('Please enter a positive number.');
36 } else {
37 document.getElementById('vote').setCustomValidity('');
You should use the $document service instead of the default document object
9 votes.reduce((a, b) => a + Math.pow(b - voteAverage, 2), 0) / voteCount,
10 );
11 document.getElementById('vote-count').innerHTML = `${voteCount} votes cast`;
12 document.getElementById('pi-value').innerHTML = `$${piValue}`;13 document.getElementById('vote-average').innerHTML =
14 `Average vote: $${voteAverage.toFixed(2)}`;
15 document.getElementById('vote-standard-deviation').innerHTML =
You should use the $document service instead of the default document object
8 const voteStandardDeviation = Math.sqrt(
9 votes.reduce((a, b) => a + Math.pow(b - voteAverage, 2), 0) / voteCount,
10 );
11 document.getElementById('vote-count').innerHTML = `${voteCount} votes cast`;12 document.getElementById('pi-value').innerHTML = `$${piValue}`;
13 document.getElementById('vote-average').innerHTML =
14 `Average vote: $${voteAverage.toFixed(2)}`;
Description
Instead of the default document object, you should prefer the AngularJS wrapper service $document.
Rule based on Angular 1.x
Bad Practice
// invalid
document.title // error: You should use the $document service instead of the default document object
Recommended
// valid
$document[0].title = ""