Forum Discussion

gauravsc's avatar
gauravsc
Explorer | Level 3
7 years ago
Solved

How do i integrate Dropbox chooser with Angular app?

I am using angular v 7 which is currently stable angular version. I would like to use angular chooser in my application. I have used it with JavaScript/AngularJS . There i can import script with my app key. Here in angular 7, i need it to work with typescript. How do i do that? If chooser is not available in this scenario, how can i mimic it's functionality?

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    The Dropbox Chooser isn't officially supported in Angular unfortunately, but I'll pass this along as a feature request. 

    If you wanted to replicate the functionality using the Dropbox API, you could do so using the following endpoints (or corresponding methods in an SDK/library), but it would be substantially more work:

  • dbrw's avatar
    dbrw
    New member | Level 2

    this works... somewhere in your component.ts: (remember the script tag in index.html or wherever)

    const options = {

      success: (files) => {

        // do something

      },

    };

    const dropbox = (window as any).Dropbox;

    const dropboxBtn = dropbox.createChooseButton(options);

    document.getElementById('<your div id>').appendChild(dropboxBtn);