Trying build a crud application,
Below is my html form, I want to fetch data from the form to the .ts file to save in to the database, it would be great help for me.
Are you talking about how to get value from input? if yes then try this solution:
in html: <input type="text" class="form-control bg-none border-0" (input)="onGetValue($event)" />
and in ts, define function onGetValue and pass the event like this:
thanks, Hammad6264 I applied your code , it is showing " Error: Uncaught (in promise): NullInjectorError."
Am i missed any dependencies to add? I am new to ionic.
It would be very helpful for me if you can show me sending data to the API as well.
You can use ( HttpClient ) for this. Then send your response to some url or API let say. for this you first have to declare ( HttpClientModule ) from ( @angular/common/http ) in app.module.ts inside imports: and import it at the top. Something like this:
in this screenshort the data object is have some dummy text, and We want to post it url or API. you can post this data using httpClient which have a post method which allows us to do that:
inside the post method, you have to pass some arguments, the first argument is your url and second one is the object you wanted to be pass. I Hope you will be understand how it works and I hope it will help you. let me know if it works? or you face any other issue?