我正在使用独立的Google AppScript和AngularJS创建一个单页Webapp。我想将Google Picker嵌入到IFRAME中,而不是显示对话框。我可以加载它,但是它不会触发回调。这是我的选择器代码:
//create upload picker
this.pick = function () {
var picker = new google.picker.PickerBuilder()
.addView(new google.picker.DocsUploadView())
.enableFeature(google.picker.Feature.NAV_HIDDEN)
.hideTitleBar()
.setOAuthToken(token)
.setDeveloperKey(DEVELOPER_KEY)
.setCallback(pickerCallback)
.setOrigin('https://script.google.com')
.setSize(500, 100)
//.build();
vm.url = picker.toUri();
console.log(vm.url)
}
此函数通过
加载到iframe中<iframe ng-src={{url}} width="100%" height="300"></iframe>
和我的回叫:
function pickerCallback(data) {
var action = data[google.picker.Response.ACTION];
}