Guest User

Untitled

a guest
Jul 22nd, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. getIpAddress() {
  2. return this.http.get<{ ip: string }>('https://jsonip.com/');
  3. }
  4.  
  5. ipAddress: any;
  6.  
  7. ...
  8.  
  9. getIp() {
  10. this.ipService.getIpAddress()
  11. .subscribe(data => {
  12. return this.ipAddress = data['ip'];
  13. });
  14. }
  15.  
  16. <input
  17. matInput
  18. placeholder="Indirizzo IP"
  19. formControlName="lastIp"
  20. [errorStateMatcher]="matcher"
  21. [(ngModel)]="ipAddress"
  22. [readonly]="true">
  23.  
  24. app.use((req, res, next) => {
  25. res.setHeader('Access-Control-Allow-Origin', '*');
  26. res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');
  27. res.setHeader('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Accept, Authorization, Content-Type');
  28. res.setHeader('Access-Control-Allow-Credentials', true);
  29. next();
  30. });
Add Comment
Please, Sign In to add comment