Anyone knows how to create an angular2 service with Ionic2 v2.1.0 ?
Already tried a lot of things but keep getting errors.
I followed some answers from here How to use angular 2 service with Ionic 2 but it doesn't work...
Here is my code
DataBaseService.ts
import {Injectable} from "@angular/core";
@Injectable()
export class DataBaseService {
constructor() {
}
execSQL() {
console.log('call works');
}
}
Imported in "app.component.ts"
import { DataBaseService } from 'DataBaseService';
And put it in the @Component of "app.component.ts"
@Component({
templateUrl: 'app.html',
providers: [DataBaseService]
})
If I run the app this way, I get the following error
Uncaught Error: Cannot find module "DataBaseService"