Since the chapter is about dynamic form modification, you're going to need the $factory at some point, even though it isn't in the example. I've changed the example to use it though, for more clarity.