-1

I am working on project based on a website with NodeJs and AngularJs. I am a beginner and somehow have written the code based on the architecture of how these two interact with each other. I have also incorporated the code for plotting the graph with static values using FusionChart library in a file called fusionchart.js.

However, I am struggling to replace the static dataset with the dynamic one which is getting read from a server in a filename dynamicdata.js.

I cannot share the code due to the "code share clause" but Can someone help me in figuring out what should be the steps to make sure the dynamic data in dynamicdata.js is visible in the fusionchart.js?

1 Answers1

0

It is pretty difficult to help you without posting you code. If I understand correctly, you have some set of functions which produce data on the server, and you want to pass this to the client.

In order to do this, you need to use some sort of client/server communication mechanism. Perhaps the easiest is ajax- your server would respond to HTTP get requests, and send back the data in JSON format. I would read this guide, as it should be a good foundation for writing your app.

Derek Brown
  • 4,232
  • 4
  • 27
  • 44
  • Okay, the thing is there is global variable in dynamicdata.js which is a json object and i want to use this variable in the angular controller. For example: In dynamicdata.js: var a; some function(){ //reads data from server and saves it in a; return a; } Now in the fusionchart.js, there is an angular controller: var app = angular.module('app',[]); app.controller('myController,' function($scope){ // i want that var a in here }); – emily brown Oct 22 '17 at 01:12
  • @emilybrown take a look at that link – Derek Brown Oct 22 '17 at 04:52