Bu yazımızda RxJs Kütüphanesinde Of operatörünü kullanımı yazıcam.
Of operator içerisine vereceğimiz herhangi bir dizin, int değer, foksiyondan ve ya strig değerden geriye bir Observable döndürür. Bu Fonksiyona subscribe olduktan sonra içinde tanımladığımız değişkenlere erişebiliriz.
import { Component } from '@angular/core';
import { of } from "rxjs";
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'UdemyRxjsLibrary';
constructor() {
const values = of("Mustafa", 4, [1, 2, 3], "Mehmet", 4.12);
values.subscribe(data => {
console.log(data);
});
}
}
Console aşağıdaki değerleri dönecektir.

Of operator’un bu şekilde kullanımı vardır.