Skip to content

Commit 751e69a

Browse files
authored
Correcting the scope of getUserProfile()
The `getUserProfile()` method should be inside the service class to correctly access `this.http`
1 parent ff907cf commit 751e69a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -685,10 +685,10 @@
685685
@Injectable()
686686
export class UserProfileService {
687687
constructor(private http: HttpClient) { }
688-
}
689688
690-
getUserProfile() {
691-
return this.http.get(this.userProfileUrl);
689+
getUserProfile() {
690+
return this.http.get(this.userProfileUrl);
691+
}
692692
}
693693
```
694694
3. Create a component for subscribing service:
@@ -1502,4 +1502,4 @@
15021502
| AngularJS | Angular |
15031503
|---- | ---------
15041504
| Dependency injection tokens are always strings | Tokens can have different types. They are often classes and sometimes can be strings. |
1505-
| There is exactly one injector even though it is a multi-module applications | There is a tree hierarchy of injectors, with a root injector and an additional injector for each component. |
1505+
| There is exactly one injector even though it is a multi-module applications | There is a tree hierarchy of injectors, with a root injector and an additional injector for each component. |

0 commit comments

Comments
 (0)