Converted from JQuery-based UI to AngularJS