I have a file that contains fixed data under the name QRCategories and I need to transmit this data as an observable.
The service responsible for sending this data is:
public qrCodeCategoriesList(): Observable<QRCategoryListResponse> {
return of (QRCategories);
}
This service is utilized in a component as follows:
ngOnInit() {
this.qrCategoryService.qrCodeCategoriesList().subscribe(
res => {
this.qrCategories = res;
}, error => {
console.log(error);
}
);
}
Although it functions without any issues, there is an error showing "Property 'assign' does not exist on type" within a different component in the following code snippet:
const formData: RegisterData = this.registerForm.value;
const password2 = {password2: formData.password1};
const data = Object.assign({}, formData, password2);
qr-category.ts
import {QRCategoryListResponse} from '../models/qr/qr-category.model';
export const QRCategories: QRCategoryListResponse = {
count: 10,
next: null,
previous: null,
results: [
{
id: 1,
name: 'Website URL',
},
{
id: 2,
name: 'Google Maps',
},
{
id: 3,
name: 'PDF',
},
{
id: 4,
name: 'Image',
}
]};