would be better to use

    angular.toJson({username: params.search});

this search param might need escaping