This solution uses the component syntax introduced in Angular 1.5, and has the controller defined inline.