Error: No provider for ConnectionBackend!


#1

Runtime Error
Uncaught (in promise): Error: No provider for ConnectionBackend! Error at d (http://localhost:8106/build/polyfills.js:3:3991) at injectionError (http://localhost:8106/build/main.js:1509:86) at noProviderError (http://localhost:8106/build/main.js:1547:12) at ReflectiveInjector_.throwOrNull (http://localhost:8106/build/main.js:3048:19) at ReflectiveInjector.getByKeyDefault (http://localhost:8106/build/main.js:3087:25) at ReflectiveInjector.getByKey (http://localhost:8106/build/main.js:3019:25) at ReflectiveInjector.get (http://localhost:8106/build/main.js:2888:21) at AppModuleInjector.NgModuleInjector.get (http://localhost:8106/build/main.js:3835:52) at resolveDep (http://localhost:8106/build/main.js:11208:45) at createClass (http://localhost:8106/build/main.js:11069:35) at createProviderInstance (http://localhost:8106/build/main.js:11036:26) at createProviderInstance (http://localhost:8106/build/main.js:10878:64) at createViewNodes (http://localhost:8106/build/main.js:12245:49) at createRootView (http://localhost:8106/build/main.js:12160:5) at callWithDebugContext (http://localhost:8106/build/main.js:13291:42)
Stack
Error: Uncaught (in promise): Error: No provider for ConnectionBackend!
Error
at d (http://localhost:8106/build/polyfills.js:3:3991)
at injectionError (http://localhost:8106/build/main.js:1509:86)
at noProviderError (http://localhost:8106/build/main.js:1547:12)
at ReflectiveInjector
.throwOrNull (http://localhost:8106/build/main.js:3048:19)
at ReflectiveInjector
.getByKeyDefault (http://localhost:8106/build/main.js:3087:25)
at ReflectiveInjector
.getByKey (http://localhost:8106/build/main.js:3019:25)
at ReflectiveInjector
.get (http://localhost:8106/build/main.js:2888:21)
at AppModuleInjector.NgModuleInjector.get (http://localhost:8106/build/main.js:3835:52)
at resolveDep (http://localhost:8106/build/main.js:11208:45)
at createClass (http://localhost:8106/build/main.js:11069:35)
at _createProviderInstance (http://localhost:8106/build/main.js:11036:26)
at createProviderInstance (http://localhost:8106/build/main.js:10878:64)
at createViewNodes (http://localhost:8106/build/main.js:12245:49)
at createRootView (http://localhost:8106/build/main.js:12160:5)
at callWithDebugContext (http://localhost:8106/build/main.js:13291:42)
at d (http://localhost:8106/build/polyfills.js:3:3991)
at l (http://localhost:8106/build/polyfills.js:3:3244)
at Object.reject (http://localhost:8106/build/polyfills.js:3:2600)
at NavControllerBase._fireError (http://localhost:8106/build/main.js:43469:16)
at NavControllerBase._failed (http://localhost:8106/build/main.js:43457:14)
at http://localhost:8106/build/main.js:43512:59
at t.invoke (http://localhost:8106/build/polyfills.js:3:11562)
at Object.onInvoke (http://localhost:8106/build/main.js:4403:37)
at t.invoke (http://localhost:8106/build/polyfills.js:3:11502)
at n.run (http://localhost:8106/build/polyfills.js:3:6468)
at http://localhost:8106/build/polyfills.js:3:3767
at t.invokeTask (http://localhost:8106/build/polyfills.js:3:12256)
at Object.onInvokeTask (http://localhost:8106/build/main.js:4394:37)
at t.invokeTask (http://localhost:8106/build/polyfills.js:3:12177)
at n.runTask (http://localhost:8106/build/polyfills.js:3:7153)
Ionic Framework: 3.1.1
Ionic App Scripts: 1.3.6
Angular Core: 4.0.2
Angular Compiler CLI: 4.0.2
Node: 6.10.3
OS Platform: Windows 10
Navigator Platform: Win32
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36

[BBCode]import { Component } from ‘@angular/core’;
import { NavController } from ‘ionic-angular’;
import { Http } from ‘@angular/http’;
import { HttpModule } from ‘@angular/http’;
import ‘rxjs/Rx’;

@Component({
selector: ‘page-leitor’,
templateUrl: ‘leitor.html’,
providers: [Http, HttpModule]

})

export class LeitorPage {

constructor(private http: Http, public navCtrl: NavController) {
this.http = http;
this.http.get(‘http://pastebin.com/raw/Qccx24pA’).map(res => res.json()).subscribe(data => {
console.log(data);
});
}

}
n[/BBCode]


#2
  • Do: import HttpModule in your app module
  • Don’t: include Http in its providers stanza

#3

Please edit your post and use the </> button above the post input field to format your code or error message or wrap it in ``` (“code fences”) manually. This will make sure your text is readable and if it recognizes the programming language it also automatically adds code syntax highlighting. Thanks.


#4

Cool . It works . Thanks