in test.controller.ts file
import {repository} from '@loopback/repository';
import {ProductRepository} from '../repositories';
export class TestController {
constructor(
@repository(ProductRepository)
public productRepository: ProductRepository,
) { }
static async createData(data:any){
await this.productRepository.updatedById(11, {'code': 'asd1232d'});
return true;
}
}
gives me an error in vs code Property 'productRepository' does not exist on type 'typeof TestController'.
Your createData() is static you can't call an instance injected via your constructor in a static method.