[Angular 2] Injecting a Service

Posted Answer1215

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Angular 2] Injecting a Service相关的知识,希望对你有一定的参考价值。

Using Services in Angular 2 is very simple. This lesson covers how to create a simple class as a Service then set it up so that you can use it across all your Components.

 

In the bootstrap() we can inject the service to the application. Then the service is available to the whole application. But what if we don‘t want to make it available to the whole application?

 

以上是关于[Angular 2] Injecting a Service的主要内容,如果未能解决你的问题,请参考以下文章

Error injecting: org.apache.maven.artifact.installer.DefaultArtifactInstaller com.google.inject.Prov

将 $http 注入 angular factory($exceptionHandler) 会导致循环依赖

Repair MySQL 5.6 GTID replication by injecting empty transactions

[Angular 2] @ViewChild to access Child component's method

[Angular 2] Async Http

Consider injecting the bean as one of its interfaces or forcing the use of CGLib-based proxies by se