Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 230059

How to pass object from Provider to Component and shows these Data to view?

$
0
0

My Login.ts file

logForm = function()
{

this.loginProvider.login(this.user);

}

And Provider method:

login(user) {
let data: object;
let dt = “grant_type=password&username=” + user.username + “&password=” + user.password;

let headers = {
  'Content-Type': 'application/x-www-form-urlencoded'
};

this.http.post(this.baseUrl, dt, { headers }).subscribe(
  res => {
    data = res;
    console.log(data);
    return data ;
  },
  err => {
    alert("Error!");
  });

}


Viewing all articles
Browse latest Browse all 230059

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>