Consuming events as Observables in Angular 2

Share this video with your friends

Send Tweet

In this video series we’ll take a look at Observables in Angular 2. We’ll figure out how they integrate with the http layer and how we can leverage their power to build a rock solid instant search with just a bunch of operators.

This first video walks you through the process of refactoring an existing solution to consume events from the template as Observables.

Karstacian
Karstacian
~ 8 years ago

If I call the subscribe in the search function will it not create a new subscription each time I call search?

Creativestyle
Creativestyle
~ 8 years ago

It seems to me that there is a typing in : URLSerachParams (Search not Serach)

Oscar
Oscar
~ 8 years ago

+1, would be nice to have a github repo to this post so it can be updated. I am receiving no provider for connectionbackend! as an error with described code above

Corey
Corey
~ 8 years ago

Hi, found the issue with the error you noted above, I was importing the HttpModule and needed to import the JsonpModule under the 'imports' property in @NgModule decorator.

James
James
~ 8 years ago

for brevity:

// app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule, JsonpModule } from '@angular/http';

import { AppComponent } from './app.component';
import { WikipediaSearchService } from './wikipedia-search.service';

@NgModule({
  declarations: [
    AppComponent,
  ],
  imports: [
    BrowserModule,
    FormsModule,
    HttpModule,
    JsonpModule
  ],
  providers: [
    WikipediaSearchService
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }

Kemal Yalcinkaya
Kemal Yalcinkaya
~ 8 years ago

URLSerachParams seems to be deprecated by the Angular team, FYI

Varghese Pallathu
Varghese Pallathu
~ 8 years ago

I'm learning ngrx and came across a similar problem for fetching data from the server and displaying. Here is the code for it: https://github.com/ngrx/example-app/blob/master/src/app/effects/book.ts

My question is why the ngrx example is done differently with just Observable and not Subject. I also posted a question in stack overflow at http://stackoverflow.com/questions/42596635/why-takeuntil-is-necessary-in-this-ngrx-example

Dominik Sipowicz
Dominik Sipowicz
~ 8 years ago

Where is used map here in this lesson? import 'rxjs/add/operator/map';

carolina
carolina
~ 7 years ago

Hello, I received this bug running that code:

Refused to execute script from 'https://en.wikipedia.org/w/api.php?callback=ng_jsonp.__req0.finished' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

Could you help me? Thanks