Update controller.ts

Fix compiler error and add sample.