Exercise Wednesday

Reminder: Don't forget you're required to sign up for a group project by the end of the day Wednesday! See here for more details.

Goal: Continue practicing creating applications with Angular CLI, while also familiarizing yourself with the process of dynamic routing.

Warm Up

  • What is different about a dynamic route, as opposed to a static route?
  • How does a dynamic route fill its dynamic segment?
  • What are the three primary parts of dependency injection? How do they work together?
  • Walk through the process of injecting a service into a component with your partner. What code needs to be inserted where?
  • What benefits does "fat arrow syntax" offer? When should we use fat arrow syntax to reap these benefits?


Online Marketplace Continued

Begin today by following along with last night’s homework to continue developing the online marketplace application.

Choose Your Own Adventure

Create a role-playing game that allows your users to choose different paths within a world of your own creation. Users should be presented with scenarios, and different choices for how their character should respond. Selecting a choice should then take users to another room or scenario creating a tree-like structure of adventure possibilities. Examples of these types of games include Clickhole's series of text adventures, or the community-driven ChooseYourStory site.

Start small; create one scenario with few basic options that dynamically route to different scenarios. Once you have a few scenarios in place allow users to begin with a certain number of points. If they make beneficial decisions, their points should increase. If they make poor decisions, they should decrease. If point values dip beyond a minimum value (determined by you) the user loses.

Here are some more user stories to get you started:

  • As a user, when I start the game, I would like to be able to add characteristics about myself, so I feel more connected to the role I am playing.
  • As a user, I want to read a description of my current surroundings and scenario, so I may determine what I'd like to do in response.
  • As a user, I want to be able to select from at least 2 options at the end each scenario, so I may take a unique path and have a different experience than a different user.
  • As a user, I would like my choices to affect my points, so I can tell if I am winning or not.
  • As a user, I want to be able to see my current points at any given time.
  • As a user, I want to be informed that I've lost if my points go beyond a minimum level.

Further Exploration

  • You may hit a point where you want to carry information across routes. In this case try leveraging firebase and your service to carry information across routes.
  • Eventually, your site could include multiple storylines, and the user could select which adventure they'd like to embark upon.
  • Allow users to pick characteristics or abilities when creating their character. Then, allow these abilities to later affect certain scenarios.

Peer Code Review

  • A router is used to successfully navigate between multiple pages and routes.
  • Project has been created with Angular CLI
  • A service persists data throughout multiple parts of the application.
  • Application works as expected.