
上QQ阅读APP看书,第一时间看更新
Implementing the Workout component
The WorkoutComponent is responsible for managing a workout. This includes creating, editing, and viewing the workout. Due to the introduction of WorkoutBuilderService, the overall complexity of this component will be reduced. Other than the primary responsibility of integrating with, exposing, and interacting with its template view, we will delegate most of the other work to WorkoutBuilderService.
The WorkoutComponent is associated with two routes/views, namely /builder/workout/new and /builder/workout/:id. These routes handle both creating and editing workout scenarios. The first job of the component is to load or create the workout that it needs to manipulate.