'how to write or change a value in json file with angular
I have this json file. Can I write into this file or change a value without node js just angular? I want to change watch to true is it possible?
[
{
"id":1,
"label": "The Crown",
"image": "crown.jpg",
"genre": "Drama",
"rate": 3,
"watch": false
},
{
"id":2,
"label": "Venom",
"image": "venom.jpg",
"genre": "Marvel",
"rate": 1,
"watch": false
},
]
Solution 1:[1]
Let say you have
items = [
{
"id":1,
"label": "The Crown",
"image": "crown.jpg",
"genre": "Drama",
"rate": 3,
"watch": false
},
{
"id":2,
"label": "Venom",
"image": "venom.jpg",
"genre": "Marvel",
"rate": 1,
"watch": false
},
]
In javascript / typescript, you can do
items[0].watch = true;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Sebastien Servouze |
