The jsonData fails to display on the console without any errors, it simply refuses to print

.controller('StocksCtrl',['$scope','$stateParams','$http',
  function($scope, $stateParams) {

    //Retrieving stock data from Yahoo Finance API
    $http.get("http://finance.yahoo.com/webservice/v1/symbols/YHOO/quote?bypass=true&format=json&view=detail")
      .then(function(jsonData) {
        console.log(jsonData);
      });



  $scope.ticker = $stateParams.stockTicker;
}]);

Answer №1

You forgot to include the $http dependency in your function.

.controller('StocksCtrl', ['$scope', '$stateParams', '$http',
    function($scope, $stateParams,$http) {

        // Retrieve stock quote data using Yahoo Finance API
        $http.get("http://finance.yahoo.com/webservice/v1/symbols/YHOO/quote?bypass=true&format=json&view=detail")
            .then(function(jsonData) {
                console.log(jsonData);
            });

        $scope.ticker = $stateParams.stockTicker;
    }
]);

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Smoothly drag and drop an element using Selenium in C#

Attempting to adjust a slider to a specific position, but it's not moving smoothly - instead, moving in bursts. Is there a way to fix this by perhaps running a piece of JavaScript code? This is the C# code I'm currently using. List<int> Tra ...

Spring Boot: The Ultimate Solution for JSON Data Retrieval

As I work on constructing a REST API, I've come across multiple methods for returning JSON data. However, I am seeking the most effective approach that is scalable over time and can manage many-to-many relationships, along with deep relations such as ...

The size of the div adjusts post sliding action

I have a unique little script that I've included below which is designed to add a series of divs to a sliding panel triggered by a button click. <script type="text/javascript"> // Clicking the button initiates the slide for the panel. $ ...

What could be causing the lack of updates for a watched object in vue?

Although there are many similar questions on this topic, mine has a unique twist. After delving into reactivity in depth, I feel like I have a solid grasp of the concept. However, one thing continues to baffle me: Summary: Why does a watched property det ...

Troubleshooting why passing $var within @{{ }} in Vue.js + Laravel is not functioning as expected

I am integrating Algolia Vue-InstantSearch into a Laravel Project. Since we are working with a blade file, the {{ }} symbols will be recognized by the php template engine. To ensure that they are only understood by Vue in JavaScript, we can add an @ prefix ...

Using Ajax and Session Variables for a Worksafe Filter to selectively hide images

Creating a photography portfolio with some images containing nudity prompts the need to hide them by default until the user chooses to reveal them by clicking a "Toggle Worksafe Mode" button. To prevent "confirm form resubmission" errors when users naviga ...

Importing modules in Node can be done after the code has been executed, or through ESM Dynamic

I am currently working on a project in nodejs and express, and I am facing an issue where I need to execute certain code before importing modules. The app is already set up to use import for modules instead of require, and changing this setting is not an o ...

Utilizing JavaScript to create multiple HTML tables from JSON data

Is it necessary to create separate tables in HTML for each set of JSON data when all tables have the same number of columns (2 columns)? I am looking to minimize the JavaScript function that displays the table with the current JSON data. Can I use one tabl ...

HTML form with a dropdown menu

Imagine you have a HTML form containing two dropdown lists. The first dropdown is labeled "country" and contains a list of countries. The second dropdown, labeled "cities," should be dynamically populated based on the country selected. What is the best ...

React application triggers `OnKeyDown` event just once

Hey there! I'm diving into the world of web development and could use some help. My current challenge involves manipulating input data based on key combinations like ctr + ArrowUp (increase) and ctr + ArrowDown (decrease). The dynamic part should be h ...

What is the best way to update a value and trigger a re-render in ReactJS?

this.state={ value: 'v1', newValue: '', } componentDidMount = () => { let nV = this.state.value + 'received'; this.setState({ newValue: nV, }); } tabClick = (val) => { this.setState({ value: val, ...

The ItemFileReadStore fetch function encounters issues when the response data contains nested objects

I'm currently utilizing the Dojo toolkit to fetch data from an external JSON source, which is essentially a web service, via an AJAX request. I am then using this data to create an ItemFileReadStore, after which I utilize its fetch method to print out ...

Using Node to upload various large JSON files into mongoDB

Currently, I am dealing with the task of parsing numerous large JSON files into my mongoDB database. To accomplish this, I have been utilizing the stream-json npm package. The process involves loading one file at a time, then manually changing the filename ...

Insert within a canvas

Although there is a previous inquiry on this topic, it appears to be outdated. Despite searching through dartlang's resources and conducting online research, I have yet to find a solution to the issue at hand. document.onPaste.listen((e) { ...

The form post request cannot recognize the undefined variable

When attempting to send values through an HTML form and retrieve it in console.log, I encounter an error that says "TypeError: Cannot read property 'fName' of undefined," despite declaring it in the form name. signin.html : <!doctype html> ...

The object's texture is not displaying

Seeking Assistance I am a beginner in the realm of Three.js and I am attempting to apply a texture to an imported object. The Issue at Hand Despite numerous attempts, I have been unable to successfully achieve this task. I encounter no errors, but the o ...

The importance of incorporating React into the scope of functional component development

While discussing class components, it's clear that they are part of the global React object. But why is it necessary to import them with every functional component? And do bundlers play a role in this requirement? I've been coding for 5 months n ...

My Telegram bot is refusing to launch

Embarking on my first bot development journey using node.js, I kicked things off by creating an empty project. Executing (npm init -y) in the console resulted in the creation of a package.json file. Next, I added dependencies via the console using (npm i [ ...

Enhance Your AngularJS Application with Data Transfer Object Models

Is there a way to implement a Data Transfer Object (DTO)? In my backend code, I have clearly defined domains such as the Client class: class Client { protected $firstName; protected $lastName; } This class contains specific properties that I wan ...

The utility of commander.js demonstrated in a straightforward example: utilizing a single file argument

Many developers rely on the commander npm package for command-line parsing. I am considering using it as well due to its advanced functionality, such as commands, help, and option flags. For my initial program version, I only require commander to parse ar ...