Rewrite edit popup as angular directive

Change-Id: Ie554889f757741c33f5e8d5ef80cfdaa613f360a