Add the spaghetti to a large saucepan of salted boiling water. Cook until al dente, drain, then cut into 2.5cm/1in lengths. Beat the eggs in a large bowl. Mix in the spaghetti, pepper and Parmesan.
Heat the oil in a non-stick frying pan over a medium heat. Add half of the pasta mixture, spreading it out to the edges like a pancake. Spread the mozzarella in a single layer on top, then layer on the tomatoes, onions and prosciutto. Finish by spreading the remaining pasta on top and pouring any egg left in the bowl over it.
Cook over a low heat for about 5 minutes. When the bottom has set and is golden brown, flip the frittata over. Cook, uncovered, for another 5 minutes or until the bottom is crisp and golden.
To serve, cut into four wedges and sprinkle with parsley. Serve warm.