Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • Why don't you move your code inside Angular? Commented Jun 15, 2016 at 8:46
  • The code is using the HTML geolocation API...I don't see how it can be moved inside the component... Commented Jun 15, 2016 at 8:48
  • I don't see what's the problem ;-). You can do everything inside Angular that you can do outside. Except maybe it's a timing issue that it must be done before Angular is finished loading. Commented Jun 15, 2016 at 8:49
  • You mean i can paste the getLocation function inside the component class and call it on a lifecycle hook? Commented Jun 15, 2016 at 8:51
  • Sure. Use declare to tell the TypeScript compiler it should assume the name exists (see my updated answer). Commented Jun 15, 2016 at 8:53