Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialhankamamut
3,177 Pointswhat is the difference
I don't understand what is the difference between the use of the Model property in the current challenge and in a challenge in the past (Using Strongly Typed Views). I don't understand why we used "Model.Characters" before and now we use "Model".
Would using "Model.DisplayText" work here as well? @foreach (var text in Model.DisplayText) { <li>@DisplayText </li> }
======================
The old challenge looked like this : @model Treehouse.Models.VideoGame @{ ViewBag.PageTitle .... } ... <div> <ul> @foreach (var character in Model.Characters) { <li>@character </li> } </ul> </div>
========================= The current challenge
@model Treehouse.Models.VideoGame[] @{ ViewBag.PageTitle .... } ... <div> <ul> @foreach (var videoGame in Model) { <li>@videoGame.DisplayText </li> } </ul> </div>
1 Answer
Steven Parker
231,269 PointsChallenges are quite likely unrelated.
The tasks in a multi-task challenge will be related and build on each other, but the challenges themselves may not have anything in common.
Also, when using strongly typed views, what "Model" represents will depend on the "@model" declaration at the top of the view file. And this declaration must match what the controller passes to the view.