Are there plans to return the JSON-loading boilerplate load() method to Providers created with
ionic generate provider MyProvider
?
As of RC3, it looks like the CLI command no longer creates a JSON loader in its generated provider. Previously, it very helpfully looked like this:
import { Injectable } from ‘@angular/core’;
import { Http } from ‘@angular/http’;
import ‘rxjs/add/operator/map’;
@Injectable()
export class TestProvider {
data: any;
constructor(private http: Http) {
this.data = null;
}
load() {
if (this.data) {
return Promise.resolve(this.data);
}
return new Promise(resolve => {
this.http.get('path/to/data.json')
.map(res => res.json())
.subscribe(data => {
this.data = data;
resolve(this.data);
});
});
}
}