BigJobbies BigJobbies - 1 year ago 454
PHP Question

Ionic 2 / Laravel 5.2 communication with the API

Im a mega newbie at Ionic 2 and Angular 2, but i have quite a bit of background in PHP.

I have built my API in Laravel 5.2, at the moment, i have a login URL as follows:

Which obviously returns a token if login is successful.

I have also built a form in ionic 2 using CSS and HTML, which is in the default /app/pages/home/home.html

What i want to do is make the login form actual communicate with the API but i cant find any examples on how to do this in Ionic v2.0.0-beta.32

All i want to do is redirect to a blank page if successful or display an alert if it fails.

I would love if someone could give me a bit of a helping hand.


Answer Source

I am not sure what exactly you mean with "make the login form actual communicate with the API".

If you mean the actual http communication you'd need to understand $http and Observables. If you search for those terms you will find plenty of information and examples.

If that is not what you mean please be more specific.