Use domo.js in an Angular 2 Application
Comments
-
It should be as simple as requiring it or importing it in the top of the file you want to use it in.
commonjs:
const domo = require('domo.js');
es6:
import * as domo from 'domo';
If you are using npm and have a package.json, include domo.js as a dependency.
Jake Galbraith0 -
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 https://registry.npmjs.org/domo.js
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:
index.html:
<script src="domo.js"></script>
app.component.ts:
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,
Hiba
0 -
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. https://github.com/DomoApps/starter-kit as well as https://github.com/DomoApps/advanced-sample-app, 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. https://github.com/DomoApps/sdk-training, and it is the legendary guide. Notice the links do not work, just follow the instructions in this issue to get started, https://github.com/DomoApps/sdk-training/issues/10.
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 Galbraith0 -
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":"com.amazonaws.services.s3.model.AmazonS3Exception: 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?
Thanks
0 -
Could you send me the TOE associated with the broken card? From there I can better diagnose.
Jake Galbraith0 -
Here's the full error:
{"status":404,"statusReason":"Not Found","message":"com.amazonaws.services.s3.model.AmazonS3Exception: 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"}
Thanks.
Hiba
0 -
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,
2 -
I am not sure if you have found your answers, if you have, please share with me as well..
My email is vincent@wavelet.net, thanks.
0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 296 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 614 Datasets
- 2.2K Magic ETL
- 3.8K Visualize
- 2.5K Charting
- 729 Beast Mode
- 53 App Studio
- 40 Variables
- 677 Automate
- 173 Apps
- 451 APIs & Domo Developer
- 45 Workflows
- 8 DomoAI
- 34 Predict
- 14 Jupyter Workspaces
- 20 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 121 Manage
- 118 Governance & Security
- Domo Community Gallery
- 32 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive