ionic framework - Angular 2: No provider for ConnectionBackend! How to solve? -
i following tutorial here https://tableless.com.br/criando-uma-aplicacao-movel-com-ionic-2-e-angular-2-em-dez-passos/ things dind't go expectend , got stuck in "no provider for..." error. (the tutorial in portuguese, think you'll looking @ code examples.)
the code this:
import { component } '@angular/core'; import { navcontroller } 'ionic-angular'; import { http } '@angular/http'; import 'rxjs/add/operator/map'; @component({ selector: 'page-home', templateurl: 'home.html' }) export class homepage { public feeds: array<string>; private url: string = "https://www.reddit.com/new.json"; constructor(public navctrl: navcontroller, public http: http) { this.http.get(this.url).map(res => res.json()) .subscribe(data => { this.feeds = data.data.children; }); } }
first, error "http". (think i) solved this:
@component({ selector: 'page-home', providers: [http], templateurl: 'home.html' })
but error "no provider connectionbackend!", , don't know how solve.
you need add httpmodule imports in app.module.
@ngmodule({ imports: [ httpmodule, <---- browsermodule, httpmodule, ], declarations: [appcomponent], providers: [], bootstrap: [appcomponent], }) export class appmodule { }
Comments
Post a Comment