I have a Chrome extension AngularJS app that implements the Dropbox and Box file chooser APIs. The extension runs within the page context via content scripts.
Everything works great except when running it on the default "New Tab" page - the chooser opens up and you can pick files but clicking the buttons on the chooser doesn't send any response back and the chooser popup just sits there. It only starts working after you navigate somewhere (anywhere), and refreshing the default page doesn't help. Here's my code, but it's standard per the respective Dropbox and Box APIs:
Dropbox:
var dropboxOptions = {
success: function(files) {
$scope.$apply(function() {
for (var i = 0; i < files.length; i++)
$scope.attachments.push({"link" : files[i].link, "name" : files[i].name, "provider" : "DROPBOX"});
});
},
cancel: function() {},
multiselect: true
};
$scope.dropBoxAttachment = function() {
Dropbox.choose(dropboxOptions);
};
Box:
var boxOptions = {'clientId': MY_CLIENT_ID, 'linkType': 'shared', 'multiselect': true};
var boxSelect = new BoxSelect(boxOptions);
boxSelect.success(function(response) {
$scope.$apply(function() {
for (var i = 0; i < response.length; i++)
$scope.attachments.push({"link" : response[i].url, "name" : response[i].name, "provider" : "BOX"});
});
boxSelect.closePopup();
});
boxSelect.cancel(function() {
boxSelect.closePopup();
});
$scope.boxAttachment = function() {
boxSelect.launchPopup();
};