In step 13, why do we need to add “@model string”? What is the model? Is it a built-in model?
Hey,
To understand what the @model string
means , you need to have a look on the ModelPage that passes the string to this view.
Somewhere on the code there will be a controller(if MVC) or PageModel(if Razor) that defines the string being sent to this view.
For example
Imagine the controller/PageModel having this code that sends it over to your view above:
public ActionResult Index(string name)
{
return View();
}
you can see from above that you are passing a “String” named “name” to the view. your view then will take that “String” and will put it at the end of the URL.
Hope this helps!