Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot find name of 'of'' Angular

Tags:

angular

I'm running this code mentioned below in Angular 7.3.2, and I'm getting error

Cannot find name of 'of'

I tried searching about keyword of in Angular couldn't find much information, can you please help if you have info about it

const nums = of(1, 2, 3);

const squareValues = map((val: number) => val * val);
const squaredNums = squareValues(nums);

squaredNums.subscribe(x => console.log(x));
like image 536
anshul mahajan Avatar asked Dec 04 '22 18:12

anshul mahajan


1 Answers

you need to import it

import { of } from 'rxjs';
like image 148
Vova Bilyachat Avatar answered Jan 16 '23 00:01

Vova Bilyachat