Property 'value' does not exist on type '() => void'.ts(2339)

Asjad Butt 71 Reputation points
2022-11-08T05:53:42.733+00:00

hi rather simple angular form error still being quite tedious so this comes when i try to post a value to the data base by using angular forms
not much to explain ill just attach a ts file for understanding
258113-image.png

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,308 questions
0 comments No comments
{count} votes

Accepted answer
  1. Zhi Lv - MSFT 32,056 Reputation points Microsoft Vendor
    2022-11-08T08:57:32.463+00:00

    Hi @Asjad Butt ,

    Please check your code, the initializeForm method/function is a void method/function, so it doesn't have the value property and the return data. So, in the AddTask method, just calling it as below:

    AddTask(){  
         this.initializeForm();  
    }  
    

    If you want to return data in the method, in the method, you need to use the return statement, like this:

    258110-image.png
    Then, calling the getItems method to get the data.

     items = this.cartService.getItems();  
    

    Refer to this tutorial: Managing data.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,
    Dillion


0 additional answers

Sort by: Most helpful