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

  1. 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.
    1. add implements OnInit to the AppComponent class
    2. add variable x in the AppComponent class
    3. add ngOnInit(){ this.x = Math.floor(Math.random()*10);}
    4. add {{x}} in the app.components.html file
    5. You should see numbers from 1-9 when you refresh the page
    6. Change formula in #c to generate numbers from 20 to 100.
    7. 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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!