rxjs相关内容
服务文件 import { Observable } from 'rxjs/Rx'; import { Http,Response} from '@angular/http'; import { Injectable } from '@angular/core'; import 'rxjs/add/operator/Map'; @Injectable() export class Vide
..
我使用此方法构建了一个简单的确认对话框服务(Angular 2): confirm(body?: string, title?: string): Subject { this.confirmation = new Subject(); // ... show dialog here... "are you sure?" return this
..
我有两个Angular2组件,需要通过服务共享数据: @Injectable() export class SearchService { private searchResultSource = new Subject() searchResult$ = this.searchResultSource.asObservable() setSearchResul
..
我有3个依赖的Rest API资源(可以说是可观察的),如下所示: 第一个可观察对象将一项作为用户数组生成,如下所示: getUsers(): Observable [ { "id": 1, "name": "Peter", "surname": "Smith" }, {
..
我正在尝试使用rxjs 在Angular中打印http调用的结果 考虑以下代码 import { Component, Injectable, OnInit } from '@angular/core'; import { Http, HTTP_PROVIDERS } from '@angular/http'; import 'rxjs/Rx'; @Injectable() class
..
我有一个主题负责订阅某些可观察的内容: var timer$ = Rx.Observable.timer(1000, 2000); 将主题链接到这样的主题 var timerSubject = new Rx.Subject; timer$.subscribe(timerSubject); var subscription1 = timerSubject.subscribe(n =
..
我正在使用最新的angular 8,对可观察物的概念还是陌生的.我有一个问题,如果我直接调用可观察对象而不将其应用于订阅变量,我是否仍需要取消订阅.以下是我想知道是否需要取消订阅的情况? 提前非常感谢 方案1-从组件调用httpService: Service - httpService getContactsHttp(){ let headers: an
..
Angular2可观察的共享不起作用,重复的http调用正在进行 BuildingService.ts @Injectable() export class BuildingService { constructor(private http: Http){ } buildings$: Observable; this.buildings:
..
我通常只浏览现有问题就可以找到自己在做错什么,但是在这里,没有任何帮助. 我正在使用一个简单的Ng2模块,该模块尝试列出和更新NeDB存储的内容. 请记住,我的NeDB存储没有问题,我已确认它已正确更新,并且最初已正确加载,所以我的问题出在其他地方. 我遇到的问题如下: “异步管道不起作用". 我有这个模块. @NgModule({ imports: [
..
我有entries$: Observable;: ,我想按groupId对其进行分组.我这样尝试过: groupBy(books => books.map(book => book.groupId)), mergeMap(innerObs => innerObs.skip(1).map(books => books.map(book =>
..
我将以下代码用于计时器: export class TimerService { private ticks: number = 0; private seconds: number = 0; private timer; constructor(seconds: number) { this.seconds = seconds; this.timer =
..
我的angular应用程序使用websocket与后端进行通信. 在我的测试案例中,我有2个客户端组件.可观察计时器会按预期打印两个不同的客户端ID. 每个ngOnInit()也会打印其客户端的ID. 现在由于某种原因,每条消息都会调用websocketService.observeClient()的预订两次,但this.client.id始终会打印第二个客户端的值. 这里
..
我正在尝试创建自己的可观察服务,但是从该服务获取初始数据后,该服务的任何更新都不会传播到任何订户.服务看起来像这样: import { Injectable } from '@angular/core'; import { Observable, BehaviorSubject } from 'rxjs/Rx'; @Injectable() export class DataService
..
我尝试链接多个rx.js可观察对象并传递数据. Flatmap应该是拟合运算符,但要导入 import { Observable } from 'rxjs/Observable'; 找不到: Error TS2339: Property 'flatmap' does not exist on type 'Observable' 使用rx.js的版本5.
..
尝试订阅Observable时出现奇怪的错误. 以下是出现问题的代码的精简版本: import {Component, Input, OnInit, ViewChild} from '@angular/core'; import Rx from 'rxjs/Rx'; @Component({ selector: 'action-overview-description',
..
我有一个可以像这样调用API的服务: return this._http .post(appSettings.apiUrl + 'SomeController/SomeAction', params, {withCredentials: true, headers: this.headers}) .timeoutWith(appSettings.maxTime
..
我一直在学习Angular 4,直到我尝试在服务中实现捕获处理之前,一切都进行得很顺利.我正在尝试使用"rxjs"捕获和抛出,但是控制台中出现未定义的函数错误. import { Injectable } from '@angular/core'; import { Http } from "@angular/http"; import { Observable } from 'rxjs/o
..
我试图利用angular2中的可观察对象,对为什么我应该在subscribe()上使用map()感到困惑. 假设我正在像这样从webApi获取值 this.http.get('http://172.17.40.41:8089/api/Master/GetAllCountry') 现在使用subscribe(success, error, complete)可以获取成功回调中的所有值,
..
我所提供的服务具有以下方法: export class TestModelService { public testModel: TestModel; constructor( @Inject(Http) public http: Http) { } public fetchModel(uuid: string = undefined): Observa
..
我目前正努力在一个订阅中使用倍数/forEach订阅,我试图检索对象列表,然后借助其ID检索图像.目前,我已经做到了: this.appTypeService.get().pipe( map((apps: AppTypeEntity[]) => { return apps.map((app) => new AppTypeEntity(app)); }) ).subscribe
..