-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathapp.js
executable file
·57 lines (48 loc) · 1.62 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
angular.module('GooglePickerExample', ['lk-google-picker'])
.config(['lkGoogleSettingsProvider', function (lkGoogleSettingsProvider) {
// Configure the API credentials here
lkGoogleSettingsProvider.configure({
apiKey : 'AIzaSyAEu079vZFFeuFjpfWOrcmw2uGxISgmWwI',
clientId : '20787361493-372fi66o31k7t4t2ha3nvj5j36blm417.apps.googleusercontent.com'
});
}])
.filter('getExtension', function () {
return function (url) {
return url.split('.').pop();
};
})
.controller('ExampleCtrl', ['$scope', 'lkGoogleSettings', function ($scope, lkGoogleSettings) {
$scope.files = [];
$scope.languages = [
{ code: 'en', name: 'English' },
{ code: 'fr', name: 'Français' },
{ code: 'ja', name: '日本語' },
{ code: 'ko', name: '한국' },
];
// Check for the current language depending on lkGoogleSettings.locale
$scope.initialize = function () {
angular.forEach($scope.languages, function (language, index) {
if (lkGoogleSettings.locale === language.code) {
$scope.selectedLocale = $scope.languages[index];
}
});
};
// Callback triggered after Picker is shown
$scope.onLoaded = function () {
console.log('Google Picker loaded!');
}
// Callback triggered after selecting files
$scope.onPicked = function (docs) {
angular.forEach(docs, function (file, index) {
$scope.files.push(file);
});
}
// Callback triggered after clicking on cancel
$scope.onCancel = function () {
console.log('Google picker close/cancel!');
}
// Define the locale to use
$scope.changeLocale = function (locale) {
lkGoogleSettings.locale = locale.code;
};
}]);