Query 1
Below is the import section of my app component with observable import that got the code working.
import {Component, OnDestroy, OnInit} from '@angular/core';
import { Observable } from 'rxjs/Rx';
import 'rxjs/add/observable/interval';
import 'rxjs/add/operator/take';
But, The IDE shows ["rxjs/Rx" ] as blacklisted usage but still it gives me the desired output using Observable.interval(1000) on browser console. Why is IDE saying this as blacklisted usage :( while it works!
Query 2
The initial code that I attempted was as below but it throws error on console and do not give me desired interval output to console.
import {Component, OnDestroy, OnInit} from '@angular/core';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/interval';
import 'rxjs/add/operator/take';
Console Error Output
rxjs_Observable__WEBPACK_IMPORTED_MODULE_1__.Observable.interval is not a function at AppComponent.push../src/app/app.component.ts.AppComponent.ngOnInit (app.component.ts:15) at checkAndUpdateDirectiveInline (core.js:9250) at checkAndUpdateNodeInline (core.js:10514) at checkAndUpdateNode (core.js:10476) at debugCheckAndUpdateNode (core.js:11109) at debugCheckDirectivesFn (core.js:11069) at Object.eval [as updateDirectives] (AppComponent_Host.ngfactory.js? [sm]:1) at Object.debugUpdateDirectives [as updateDirectives] (core.js:11061) at checkAndUpdateView (core.js:10458) at callWithDebugContext (core.js:11351)
Which is the right approach, request suggestion.
rxjs
version? – Amit Chigadani