Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
183
rated 0 times [  190] [ 7]  / answers: 1 / hits: 28719  / 9 Years ago, wed, january 20, 2016, 12:00:00

I would like to emit a single value.



According to this post, the following should be valid:



var requestStream = Rx.Observable.just('https://api.github.com/users');


However, this does not work. just is not defined.



Has it been deprecated? Is there something that I can use instead?


More From » angular

 Answers
56

A lot of the stuff is tucked away in: import 'rxjs/Rx'; You might try Observable.of for a single value.



This works for me (plunker):



import {Component} from 'angular2/core';
import {Observable} from 'rxjs/Observable';
import 'rxjs/Rx';

@Component({
selector: 'my-app',
providers: [],
template: `
<div>
<h2>Hello {{test | async}}</h2>
</div>
`,
directives: []
})
export class App {
test: Observable<any> = Observable.of(I'm an observable);
constructor() {
}
}

[#63644] Monday, January 18, 2016, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jonrened

Total Points: 627
Total Questions: 114
Total Answers: 99

Location: Zimbabwe
Member since Thu, Jul 21, 2022
2 Years ago
jonrened questions
Mon, Nov 2, 20, 00:00, 4 Years ago
Tue, May 19, 20, 00:00, 4 Years ago
Tue, Jan 21, 20, 00:00, 4 Years ago
Thu, Nov 7, 19, 00:00, 5 Years ago
;