Skip to content

Params isn't updating inside an Http Get subscription #9

Description

@StriderRanger

Hello,

Thank you for sharing this solution.

I am facing an issue with getting parameters from a JSON file, instead of passing the parameters as an object in the typescript code.
This is the content of my JSON file:

{
  "particles": {
    "number": {
      "value": 200
    },
    "color": {
      "value": "#ff0000"
    },
    "shape": {
      "type": "triangle"
    }
  }
}

and this is how I assign my params variable:

 //...
ngOnInit() {
    //...
    this.http.get("assets/particlesjs-config.json").subscribe(
        data => {
          this.params = data;
          console.log(this.params)
     });
  }

The console.log line prints the content of the json file in the console, but I can't in any way have the animation when I assign the params inside the Http Get subscription.

Thank you for your support

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions