Use domo.js in an Angular 2 Application

Hi all,


I need to use domo in an angular 2 application.

How to bind domo with the angular 2 app?




  • jake-galbraith
    jake-galbraith Domo Employee

    It should be as simple as requiring it or importing it in the top of the file you want to use it in. 



    const domo = require('domo.js');



    import * as domo from 'domo';



    If you are using npm and have a package.json, include domo.js as a dependency. 

    Jake Galbraith
  • Hi Jake,


    I am using npm, and I added domo.js as a dependency in the package.json; but i have this error:


    npm ERR! 404 Registry returned 404 for GET on
    npm ERR! 404
    npm ERR! 404 'domo.js' is not in the npm registry.
    npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
    npm ERR! 404 It was specified as a dependency of 'loreal50'


    The only solution that works for now is to do this:



    <script src="domo.js"></script> 



    declare var domo: any;


    Is there a better way?


    My second question is :


    Is there a way to query  the domo API without running "domo login" and "domo dev" commands? or directly from the application when running "npm start"?

    When I run "npm start" I have my angular 2 application running on my local server, but I have an error concerning any domo Api request (domo.get(...) for example).


    So to make the application run correctly with all the domo request, I need to do compile each time the project manually, ang use the compiled version to run "domo dev" and then I have the app working normally.


    Thank for your help,



  • jake-galbraith
    jake-galbraith Domo Employee

    Oops, it is actually named something different than domo.js in the public domain.

    Change domo.js in the npm file to "ryuu.js": "^2.5.8" under dependencies.


    Then just change your imports or requires to look at ryuu rather than domo.


    As for your second question. domo login will need to be called anytime your session expires to ensure proper authentication before making requests to the data service. So you don't have to call this every day, consider creating a token so you can stay logged in for a much longer period of time. Do this by using domo token create , pick the desired instance, how long you want the token to last, and then notice you will not need to login every time you begin development.


    We currently have a webpack, angular 1, starter-kit, with improved build tools so that you can bypass domo dev completely. as well as, shows how they implemented their own proxy to sidestep domo dev, and hook straight into domo in their own webpack configuration. Currently in progress is a domo-router to allow developers to import the proxy used to authenticate with domo in any build tool such as grunt, gulp, webpack, etc.. 


    We also have a guide on how to do exactly what starter-kit does to implement domo in their build tools., and it is the legendary guide. Notice the links do not work, just follow the instructions in this issue to get started, 


    Let me know if this is at all helpful in guiding you to ramp up your build tools to make development in the domo context any easier.


    Jake Galbraith
  • Hi,


    I am currently working on the starter-kit project.

    For now , when I run "npm run upload" (as the guide said) , everything is working fine, and I have my application published on domo platform; but when I want to create a card with the app, I have the error below displayed on the card:


    {"status":404,"statusReason":"Not Found","message":" The specified key does not exist. (Service: Amazon S3; Status Code: 404; Error Code: NoSuchKey; Request ID: ...), S3 Extended Request ID: ...","toe":"..."}


    Any ideas please?


  • jake-galbraith
    jake-galbraith Domo Employee

    Could you send me the TOE associated with the broken card? From there I can better diagnose.

    Jake Galbraith
  • Here's the full error:


    {"status":404,"statusReason":"Not Found","message":" The specified key does not exist. (Service: Amazon S3; Status Code: 404; Error Code: NoSuchKey; Request ID: 9B35E13EB72E3AD9), S3 Extended Request ID: P2BGvKMtweficEFGwOvmlHM9bOcs67UqUqTpwhHPdGs8J96cyHSqjz2PkniJee+2DiIWjKL1Ksg=","toe":"T942PLNNOC-REIEP-3JMNQ"}




  • Hi,


    Can we have a clear example of how to use ryuu.js (aka domo.js) in an angular 2+ app please ? This would be greatly appreciated, as per the lack of clear documentation for all domo development processes.


    Thank you,

  • I am not sure if you have found your answers, if you have, please share with me as well..


    My email is [email protected], thanks.

This discussion has been closed.