Unwanted popup shows when using HTTP basic auth

I am using HTTP basic auth when sending a request to my api endpoint via GET. Basically if you open my endpoint in web browser, a standard HTTP basic auth(username and password) dialog box pops up.
Using $http in angular, how can I ‘autofill’ that basic auth username and password when I $http.get that endpoint?

This is the code im using:
$http.defaults.headers.common[‘Authorization’] = 'Basic ’ + Base64.encode(username+ ‘:’ + password);
$http({method: ‘GET’, url: endpointURL}).success(function(data, status, headers, config) {
$state.go(‘tab.somewhere’);
})

Strange though, the HTTP basic auth popup does not show when in browser, it only shows on device app…