angular.js - About angular2 dependency injection
PHPz
PHPz 2017-05-15 17:07:18
0
1
588

Version: @angular@2.0.0

xhttp is an encapsulation service for http service.

@injectable()
export class Xhttp {
    constructor (@Inject(Http) private http: Http) {}
}

Originally, this part of the service was written under Project A, but considering reuse, it was planned to be made into a separate module. After proposing it, using npm to install the above code, an error will be reported:

No provider for Http!

This module has been introduced in the provider in the top-level module.

Please also help me take a look.

PHPz
PHPz

学习是最好的投资!

reply all(1)
仅有的幸福

Have you installed the module @angular/http?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template