Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
StriderRanger opened this issue Dec 18, 2017 · 0 comments
Open

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

StriderRanger opened this issue Dec 18, 2017 · 0 comments

Comments

@StriderRanger
Copy link

StriderRanger commented Dec 18, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant