Posted by: asim km
« on: Sep 04 2023, 06:26:16 »When the user clicks on this link, they will be redirected to a form filled with the details of the video. When they click Save, the changes are saved and they are returned to the home page. Step 1: Create an endpoint This step should be familiar to everyone. We'll create two new routes: Get and thus open . And add the following route: Note that here we have a route parameter, denoted by a colon . You can access the value of this parameter using . Other than that, the rest of the routing configuration is similar to what you saw before.
The only difference is that we use the collection's method to return only one object. The first parameter of this method is an object. Therefore, we are looking for documents that are Phone Number List equal to . Now, create another route: Note that we defined this route with . This handler will only be called when there is a request to this endpoint. We use the method of the collection object to update the document. The first parameter is the condition object. We try to update only documents that are equal to . The second parameter represents the value to be updated.

The rest is very simple. Step we need to add a link to each video on the home page. Open and change as shown below: We use a binding expression to render the dynamic based on the video. Again, note that prefixed with for compatibility with older browsers. Now we need a view with a form to edit the video. However, we already have a view with a form. Therefore, it is better to reuse it. In , add the following new route: I haven't set up a controller for the route since we haven't created the controller yet. Let's review what we've done so far. Go back to your browser, go to the home page and make sure to refresh the page.
The only difference is that we use the collection's method to return only one object. The first parameter of this method is an object. Therefore, we are looking for documents that are Phone Number List equal to . Now, create another route: Note that we defined this route with . This handler will only be called when there is a request to this endpoint. We use the method of the collection object to update the document. The first parameter is the condition object. We try to update only documents that are equal to . The second parameter represents the value to be updated.

The rest is very simple. Step we need to add a link to each video on the home page. Open and change as shown below: We use a binding expression to render the dynamic based on the video. Again, note that prefixed with for compatibility with older browsers. Now we need a view with a form to edit the video. However, we already have a view with a form. Therefore, it is better to reuse it. In , add the following new route: I haven't set up a controller for the route since we haven't created the controller yet. Let's review what we've done so far. Go back to your browser, go to the home page and make sure to refresh the page.