Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

186
Views
How to store large object in html data attribute without jquery

I have an angular project I'm working on where I'm trying to store an object that's being populated from a server in an HTML data attribute. This object looks something like this:

{"decimalPlaces": "2", "soft": "false"}

I've seen other solutions on stack overflow but they use jquery and I can't use that here. What I would like to be able to do is just feed the entire object to one HTML data attribute rather than have one data attribute for every property in this object. I would like for it to look something like the below line, and then be able to pull out precise data as needed from the angular component.ts file:

data-everything="allData"

And NOT like this

data-decimals="allData.decimalPlaces"
data-soft="allData.soft"

Is this possible? Also I have tried JSON.stringify as suggested in other solutions as well, in addition to console.dir to see if I could pull any data out of this "allData" but neither helped.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!