Looking for some guidance on creating an object using Angular's factory capabilities since I'm new to AngularJS. Here's the code snippet that I have:
angular.module('7minWorkout')
.factory('WorkoutPlan', function(args){
this.exercises = [];
this.name = args.name;
this.title = args.title;
this.restBetweenExercise = args.restBetweenExercise;
this.totalWorkoutDuration = function () {
if (this.exercises.length == 0) return 0;
var total = 0;
angular.forEach(this.exercises, function (exercise) {
total = total + exercise.duration;
});
return this.restBetweenExercise * (this.exercises.length - 1) + total;
}
return this;
});
Upon running this, I encountered the following error message:
Error: [$injector:unpr] Unknown provider: argsProvider <- args <- WorkoutPlan
Any insights on what might be causing this issue?
Appreciate any help!