Skip to content

Commit da827d8

Browse files
committed
env file added
1 parent c5b5112 commit da827d8

File tree

5 files changed

+22
-3
lines changed

5 files changed

+22
-3
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ Change the value of `target` in `proxy file` as your backend api url
1919
yarn develop
2020
```
2121

22+
## Generating Environmental files in Angular 15+
23+
24+
```sh
25+
ng g environments
26+
```
27+
2228
## Cloning Guide
2329

2430
1. Clone only the remote primary HEAD (default: origin/master)

angular.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,13 @@
5151
"development": {
5252
"optimization": false,
5353
"extractLicenses": false,
54-
"sourceMap": true
54+
"sourceMap": true,
55+
"fileReplacements": [
56+
{
57+
"replace": "src/environments/environment.ts",
58+
"with": "src/environments/environment.development.ts"
59+
}
60+
]
5561
}
5662
},
5763
"defaultConfiguration": "production"

src/app/places/places.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Component, input, output } from '@angular/core';
22

33
import { Place } from '../models/place.model';
4+
import { environment as env } from '../../environments/environment.development';
45

56
@Component({
67
selector: 'app-places',
@@ -12,8 +13,8 @@ import { Place } from '../models/place.model';
1213
export class PlacesComponent {
1314
places = input.required<Place[]>();
1415
selectPlace = output<Place>();
15-
// protected url = 'http://localhost:3000/';
16-
protected url = 'https://3000-actionanand-angularhttp-six5y8k89a8.ws-us116.gitpod.io/';
16+
17+
protected url = env.backendUrl;
1718

1819
onSelectPlace(place: Place) {
1920
this.selectPlace.emit(place);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const environment = {
2+
backendUrl: 'https://3000-actionanand-angularhttp-six5y8k89a8.ws-us116.gitpod.io/',
3+
};

src/environments/environment.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const environment = {
2+
backendUrl: 'https://3000-actionanand-angularhttp-six5y8k89a8.ws-us116.gitpod.io/',
3+
};

0 commit comments

Comments
 (0)