Home Ionic how to display result from .ts file?
Reply: 0

Ionic how to display result from .ts file?

user794
1#
user794 Published in April 26, 2018, 1:42 pm

I have created an application, and I get the data from my API, after that I successfully do all the calculation, and the answer is saved inside a variable inside my .ts file show in below

  getApiData_record() {
    this.restProvider.getApiData_record().then(data =>{
      this.users = data;
      var totalDuration=0;
      var fee1 = [];

      for (var i of this.users){ 
        fee1.push(i.fields.duration);
      }

      for (var j=0; j < fee1.length; j ++){
        console.log("here", fee1[j])
        totalDuration = totalDuration + fee1[j];
      }

      console.log("Record Here", data, totalDuration)
      return totalDuration;
    })
  }

Now I need to totalDuration to be show in my .html page, how I show the results?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.33663 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO