Answers for "angularjs make post request"

5

angular post request

ngOnInit() {          
     this.http.post<any>('https://reqres.in/invalid-url', { title: 'Angular POST Request Example' }).subscribe({
        next: data => {
            this.postId = data.id;
        },
        error: error => {
            this.errorMessage = error.message;
            console.error('There was an error!', error);
        }
    })
}

...

interface Article {
    id: number;
    title: string;
}
Posted by: Guest on May-25-2021
0

angularjs make post request

var url = 'posturl', data = 'parameters',config='contenttype';

$http.post(url, data, config).then(function (response) {

// This function handles success

}, function (response) {

// this function handles error

});
Posted by: Guest on February-29-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language