How to access JSON variable containing a point in AngularJS

Currently utilizing Sequelize, I have successfully executed an Inner Join after multiple attempts and achieved satisfying results:

{
    "success": false,
    "message": "Query not successful, the result was empty",
    "data": {
        "codWO": "1016285246",
        "codType": "01",
        "origin": "1016285246--origin",
        "solution": "1016285246--solution",
        "consecuence": "1016285246--consecuence",
        "actions": "1016285246--actions",
        "hours_stopped": 20.5,
        "failureState": "1016285246--failureState",
        "failureEquipment": "1016285246--failureEquipment",
        "failureEffect": "1016285246--failureEffect",
        "failureCause": "1016285246--failureCause",
        "wo_cor_type.name": "Emergency Repair",
        "wo_cor_type.description": "Urgent repairs such as a broken device that avoid running the test.",
        "wo_cor_type.codType": "01"
    }
}

All variables are accessible for reading, with the exception of the last three which contain periods.

How can I successfully access and read variables with periods in their names?

    vm.woCorrective = data.data;
    console.log(data.success);
    console.log(vm.woCorrective);
    console.log(vm.woCorrective.codWO);
    console.log(vm.woCorrective.solution);
    console.log(vm.woCorrective.failureCause);
    // console.log(vm.woCorrective.[('wo_cor_type.name')]);

Answer №1

Give this a shot:

displayInfo(vm.woCorrective["wo_cor_type.name"]);
displayInfo(vm.woCorrective["wo_cor_type.description"]);
displayInfo(vm.woCorrective["wo_cor_type.codType"]);

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

Utilizing PHP configurations in JavaScript with AJAX for JSON implementation

Trying to have a config.inc.php file shared between PHP and JavaScript seems to work, but when using ajax, the "error-function" is always triggered. Is there a way to successfully share the config file with working ajax implementation? This is being utili ...

Harness the power of Vue.js by implementing plugin methods in your code

For my first attempt at building a SPA with Vue, I decided to re-use a few functions but encountered some issues. The error message "this.ExperienceToLevel is not a function" kept popping up and it left me puzzled. Furthermore, I'm contemplating if c ...

jQuery DatePicker Not Displaying Calendar

I've been attempting to implement a date picker in jQuery. I've included the necessary code within the head tag: <link rel="stylesheet" type="text/css" media="screen" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jqu ...

Address Book on Rails

Hello, I'm relatively new to this and would be grateful for any assistance. My goal is to utilize the data saved by a user in their address book, and then offer them the option to use that address for delivery. Below is my Address controller: class A ...

How to customize TextField error color in Material-UI using conditional logic in React

Currently, I am incorporating the React Material-UI library into my project and faced with a challenge of conditionally changing the error color of a TextField. My goal is to alter the color of the helper text, border, text, and required marker to yellow ...

Encountering no automatic refresh feature in Next.js

Encountering an issue with Next.js where the local host index page doesn't automatically refresh whenever a change is made. To provide some context, I initiated a Next.js application using npx create-next-app --use-npm. After starting the local serve ...

Conceal a div element after initial visit

There is a button (B) that displays a menu (C) when clicked, and a pop-up (A) that also shows the same menu (C) when clicked. There are 4 tasks to accomplish here. 1) Clicking B reveals C. 2) Clicking A reveals C. 3) Clicking B hides A. 4) A should be hi ...

Update the div content to completely replace it with fresh data using Ajax

I'm currently working on implementing a currency switcher feature for my website, allowing users to toggle between two different currencies. The site is a reservation platform with a booking form displayed on the left side and the booking details occu ...

Challenges accessing all columns of a single model in Rails and AngularJS view

While working on my Rails application, I encountered an issue when trying to retrieve details of the logged-in user using an AngularJS service. The JSON data fetched from the server only displays a few columns instead of all the columns present in the mode ...

What is the best way to choose the checked items and calculate the total price by adding up all the prices of the selected items?

Seeking help with utilizing JavaScript to identify and collect all checked items from an HTML file. I'm looking to determine which items have been selected from a menu, each of which has an associated price. How can I access the prices of the chec ...

Aligning a lowercase "i" element within a container

Is there a more effective way to center the "i" element within this div without using specific pixel margins that adjust based on hover? Below is my code snippet: HTML: <div class="nav-collapse"> <i class="fa fa-bars fa-2x" id="bars"></ ...

Having trouble with Socket.io and its io.emit() method refusing to work? If communication from server to client isn't going smoothly, you may need a solution for sending data from the server to

My latest project is a document converter program that utilizes LibreOffice to convert documents to PDF format. Here's my server running on localhost:3000 import express from "express"; import bodyParser from "body-parser"; import ...

Arranging date and time in jQuery based on AM/PM notation

I have written some JavaScript code to sort dates in ascending order (from newest to oldest). I have successfully sorted the dates, but I am having trouble sorting the time with AM or PM using a 12-hour format. I can do it in a 24-hour format, but not in ...

Adjust the background color of child divs when the parent div is being hovered over

I am facing a challenge with my current setup: <div class="parent"> <div class="child"> </div> <div class="child"> </div> <div class="child"> </div> </div> My goal is to change the background co ...

What could be the reason for encountering a TypeError while attaching event listeners using a for loop?

When attempting to add a "click" event listener to a single element, it functions correctly: var blog1 = document.getElementById("b1"); blog1.addEventListener("click", function(){ window.location.href="blog1.html"; }); However, when I try to use a for l ...

How should res.render() and res.redirect() be properly utilized within Express framework?

I am struggling to understand the difference between res.render('viewname', {msg: 'Message' }) and res.redirect('route') The render function allows you to pass a "message", but the redirect function does not. However, ther ...

"Sliding through pictures with Bootstrap carousel placed beneath the

Currently, I am working on a website that requires a background image, although I personally do not prefer it. The client's preference is to have the navbar transparent so that the background image shows through it. Now, I would like to incorporate a ...

When using Sequelize's findAll() method with a where-parameter, it may sometimes return null, whereas findByPk() consistently returns

Currently, I am in the process of setting up resolvers for a GraphQL API and I'm encountering some challenges/questions related to the findAll() function from sequelize. These are the two resolvers I have: User: async (parent, { id }, { models }) =& ...

Adjust object values dynamically with TypeScript by identifying the corresponding keys

Currently, I am in the process of creating a function in TypeScript that will return another function allowing me to modify the keys of an object. This specific function is intended for use within a React reducer. For instance, if I have a state object wi ...

Sending data with React using POST request

Currently in my React application, I have a form that includes fields for username and password (with plans to add "confirm password" as well). When submitting the form, I need it to send JSON data containing the email and password in its body. The passwo ...