question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to get location with universal

See original GitHub issue

Hey,

I’m submitting a … (check one with “x”)

[ ] bug report => check the README and search github for a similar issue or PR before submitting
[ ] support request => check the README and search github for a similar issue or PR before submitting
[x] feature request

What is the motivation / use case for changing the behavior? I am creating a white label website on which the content shown is dependant from the url used by my users. I cannot use window.location as it is not available server side.

  • Angular version: 4.1.0

I would be pleased to help you implement this, but do you have any lead on how to do it ?

Thanks !!

PS: This topic seems interesting : http://stackoverflow.com/questions/43403649/how-to-get-full-base-url-including-server-port-and-protocol-in-angular-univer

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
theomathieubhvrcommented, May 26, 2017

OK i managed to do it !

I can make a Pull request if needed (but I think this is too specific).

To sum up how I did, I created a custom OriginService for server (for browser I just set origin to window.location.origin).

import { Injectable, Inject } from '@angular/core';
import { Request } from 'express';
import { REQUEST } from '@nguniversal/express-engine/tokens';

@Injectable()
export class OriginService {
  public origin: string;

  constructor(@Inject(REQUEST) private request: Request) {
    this.origin = request.hostname;
  }
}

0reactions
dr1sscommented, Aug 15, 2017

Any way to achieve this (get the express request object) with @ngx-universal/express-engine please ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Get the user's location - UWP applications - Microsoft Learn
In Solution Explorer, double-click package.appxmanifest and select the Capabilities tab. · In the Capabilities list, check the box for Location.
Read more >
Find & use location coordinates - Google Earth Help
Find coordinates for a location · Open Google Earth. · As you move your mouse over different locations, coordinates will be displayed in...
Read more >
Privacy FAQ - Universal Orlando
Whether in park or off-premise, you can elect to enable or disable location data at any time by changing the location data service...
Read more >
Directions And Parking - Universal Orlando
To Universal's Cabana Bay Beach Resort · 1) Take I-4 East toward downtown Orlando · 2) Take Exit 75A (Universal Studios) and get...
Read more >
The Official Universal Orlando Resort App
With the convenient mobile app you can navigate the parks with maps, see current wait times, show times and more—all from the palm...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found