Question: Use Math.random function to generate a number between 20 and 100 and then use the ngSwitch directive to display a letter grade based on this
- Use Math.random function to generate a number between 20 and 100 and then use the ngSwitch directive to display a letter grade based on this class grading policy.
- add implements OnInit to the AppComponent class
- add variable x in the AppComponent class
- add ngOnInit(){ this.x = Math.floor(Math.random()*10);}
- add {{x}} in the app.components.html file
- You should see numbers from 1-9 when you refresh the page
- Change formula in #c to generate numbers from 20 to 100.
- Change {{x}} in #d to ngSwitch directive
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
