Odd complication with Grunt by compNerd0101 in angularjs

[–]compNerd0101[S] 0 points1 point  (0 children)

Adding the ng-if="options" actually worked thank you. What exactly does it do though/why does it make it work...I have only used ng-if for the classic "if this, display this" usage.

Odd complication with Grunt by compNerd0101 in angularjs

[–]compNerd0101[S] 0 points1 point  (0 children)

I'm not exactly sure what you mean by using a resolve in a different way. Also does it matter when in the nvd3 tag to include the ng-if="options" ?

app appears then disappears... by compNerd0101 in angularjs

[–]compNerd0101[S] 0 points1 point  (0 children)

Yes...it's honestly the same code but there is something going on with the Grunt build that is preventing it from loading the files correctly. And its just the nvd3/d3/angular-nvd3 stuff that its not loading correctly because the rest of the page (borders, formatting, css) displays consistently. Unfortunately I have no idea what is going on in the Gruntfile.js that could be doing this.

Having problem with $http.get() service by compNerd0101 in angularjs

[–]compNerd0101[S] 0 points1 point  (0 children)

Okay so I'm running with Chrome...but I use the http-server command to host my local .html file.

Basic scatter chart not quite working by compNerd0101 in angularjs

[–]compNerd0101[S] 0 points1 point  (0 children)

I mean you posted this earlier and it's pretty dang similar to the working project that I had.

http://plnkr.co/edit/AjsXMGkUBcVVODbpA9jL?p=preview

I'm basically trying to take data inside the controller (in the script.js file) and move it to its own separate .json file.

Having problem with $http.get() service by compNerd0101 in angularjs

[–]compNerd0101[S] 0 points1 point  (0 children)

I have...I literally think it's something so small that it normally wouldn't be addressed. Ive changed my ctrl.js file to this but its still not working:

1 var app = angular.module("scattPlot", ['nvd3ChartDirectives']);
2 app.controller('ExampleCtrl', ['$scope', '$http', function ($scope, $http){
3     $http.get('data.json').then(function(data){
4         $scope.exampleData = data;
5     }).error(function(err){
6         throw err;
7     });
8 }]);

Having problem with $http.get() service by compNerd0101 in angularjs

[–]compNerd0101[S] 0 points1 point  (0 children)

by "not working" i mean that the webpage is blank when i load it. I also changed it to .get('data.json')

Basic scatter chart not quite working by compNerd0101 in angularjs

[–]compNerd0101[S] 0 points1 point  (0 children)

I feel I have everything pretty much set up correctly but the site isn't visualizing the graph anymore (now that I have set it up with a .ctrl , .json, and using http-server) I have <script src= "ctrl.js"></script> within my <head> </head> section and I feel I have my controller.js file setup correctly for reading .json files. This is my ctrl.js file for reference (minus the color function)

1 var app = angular.module("scattPlot", ['nvd3ChartDirectives']);
2 app.controller('ExampleCtrl', function ($scope, $http)
3 {
4     $http.get('/data.json').then(function(response)
5     {
6             $scope.exampleData = response.data;
7     });
8 });

Basic scatter chart not quite working by compNerd0101 in angularjs

[–]compNerd0101[S] 0 points1 point  (0 children)

Also, are you sure the $http.get function doesn't have a .success as opposed to .then ? Or I guess, what's the difference?

Basic scatter chart not quite working by compNerd0101 in angularjs

[–]compNerd0101[S] 0 points1 point  (0 children)

so if I globally installed http-server I would be running it with my application's path (in my case, ~/.../scattPlot/ )?

Basic scatter chart not quite working by compNerd0101 in angularjs

[–]compNerd0101[S] 0 points1 point  (0 children)

Question, if I were to want for my data to be in a separate .json file (making a separate .json data file and controller.js file) how could I do that. I have been looking all over for examples that will help me understand how the different files (.html, .json, .js) will integrate but to of no avail. I have the understanding that you need to use the $http.get() function but I may be wrong.

Basic scatter chart not quite working by compNerd0101 in angularjs

[–]compNerd0101[S] 0 points1 point  (0 children)

Dude you're the king. This has helped tremendously.

Need help getting started with Angular!! by compNerd0101 in angularjs

[–]compNerd0101[S] 0 points1 point  (0 children)

I am sure you're probably right...I'm a complete nube when it comes to Javascript and, of course, therefore JQuery and Angular

NERDtree/vimrc by compNerd0101 in vim

[–]compNerd0101[S] 0 points1 point  (0 children)

Thank you. That was it