From the course: Blazor: Getting Started
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Solution: Make an interesting call to JavaScript - Blazor Tutorial
From the course: Blazor: Getting Started
Solution: Make an interesting call to JavaScript
(upbeat electronic music) - [Rich] Now that you've had some time to invoke JavaScript on your own, I'll show you my solution. I started in the DataService. I changed the ray list so that when it's set, it's automatically ordered in reverse. In the ray list, I created a surrounding div for the rays and added a ref to it so that I can use this element reference here on line 21. As in the hint, I added this object that represents the key frames I'm going to animate with. I also added a Boolean flag for if the raycast had been called so that I don't animate when the ray wasn't cast. Down here, in OnAfterRenderAsync, if the ray had been cast, I invoke the JavaScript runtime with the animate element method that I created. I pass it the ray list container from this page, the set of key frames, and an integer representing 2,000 milliseconds. Once this is called, I reset the flag. Let's see how it looks. I'll select my…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
Call JavaScript from Blazor6m 37s
-
(Locked)
Call Blazor from JavaScript4m 20s
-
(Locked)
ElementReferences in JavaScript with Blazor6m 23s
-
(Locked)
Unit test JavaScript5m 55s
-
(Locked)
Challenge: Make an interesting call to JavaScript1m 34s
-
(Locked)
Solution: Make an interesting call to JavaScript1m 36s
-
-
-