would be nice to write instead of those 5 lines:

    ctrl.$setValidity('usernameavailable', result._items.length === 0);