Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- getIpAddress() {
- return this.http.get<{ ip: string }>('https://jsonip.com/');
- }
- ipAddress: any;
- ...
- getIp() {
- this.ipService.getIpAddress()
- .subscribe(data => {
- return this.ipAddress = data['ip'];
- });
- }
- <input
- matInput
- placeholder="Indirizzo IP"
- formControlName="lastIp"
- [errorStateMatcher]="matcher"
- [(ngModel)]="ipAddress"
- [readonly]="true">
- app.use((req, res, next) => {
- res.setHeader('Access-Control-Allow-Origin', '*');
- res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');
- res.setHeader('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Accept, Authorization, Content-Type');
- res.setHeader('Access-Control-Allow-Credentials', true);
- next();
- });
Add Comment
Please, Sign In to add comment