In my Ionic 2 application, I have a component that uses a service that does an HTTP GET to retrieve some data. Then my component calls this service, and when the data is available, it installs and presents it.
It looks like this :
export class FarmList implements OnInit { items: Object; constructor(public testService: TestService, public nav: NavController){ } ngOnInit(){ this.getData() } getData(){ let loading = Loading.create({ content: 'Please wait..', spinner: 'crescent' }) this.nav.present(loading) this.testService.fetchData().then(data => this.items = data) } ... }
While my component is retrieving data asynchronously, I try to make the loader rotate, and as soon as the data is available, I want the loader disappear.
However, with my current code, the spinner continues to spin even after the data is available and displayed, as you can see the screenshot:

getData() is a method that invokes a service call. How can i fix this? Is it correct to implement the bootloader?
source share