I want to import data from a csv file and insert them in MongoDB. So firstly I get the data from the csv file and I display my data in the console using AngularJS.
Now I want to pass my data (from AngularJS) to a play controller where I want to parse data and then insert it in my database.
So I defined this route:
POST /input/:data controllers.InputController.showinput(data)
Where data is the data that I get from AngularJS and InputController is my controller.
I am currently blocked, I don't know if I'm on the right track or not and also there is any example to parse my data in controller?
Instead of getting data from csv file, you can first insert csv file in mongoDB by using the monngoImport command. Then you can access data from csv file using angularjs.
Related
I have a scenario where I want to create csv file and the same generated csv file I would like to pass It to backend call.
I can generate csv file using below plugin but would like to know how can I pass It to backend once file is generated?
https://www.npmjs.com/package/react-csv
Anyone please share the Idea on It?
I have a question.
I am fetching some data from a website now what I want to do is to write that data in excel through angular and export it, now again when I want more data the file should be updated.
is there any library does that?
I did same thing in my project, but you have to pass your data or file from angular to server side (.Net )and then using any library, you can write in excel easily.
Thanks.
I need to separate chart Data in file HTML to file JSON and poster the chart and the table result --
thanks
When angular is running in the browser, the json file will be located in the server. You will need to do a angular $http.get to get the data into your angular controller. set the received data in your controller and feed it to your chart.
Just started with angular and I am debugging my angular app and would like to save a large json object. Is it possible to save this in chrome? Or how to save this with angular?
Extra info: I want to save the contents of $rootScope to a json file.
Not sure from your question where you want to save the file so I'll assume server side you could post the json to a rest service using $post (a get request will probably be too long) on the server that writes the file with the posted contents.
You should use the browser tools from your favorite browser. in your code write this code:
// ..
var json = JSON.stringify($rootScope);
console.log(json);
You will be able to copy the content from the console and you can save it into a new text file.
I have a REST API whose response json (array of objects).
I would like to provide a button in my view like "Download results to CSV" and
and when user clicks on the link csv file should be downloaded with comma separated values.
What is best way to achieve this in angularjs?
Check out this fiddle (not the author):
Fiddle
You can either implement that on your client side, or alternatively on your server side with a new API call to get the CSV file directly.