Ionic2-meteor-boilerplate + Phone service


#1

Hi,

I have this error:

ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[PhoneService -> Platform]: 
  StaticInjectorError(Platform: core)[PhoneService -> Platform]: 
    NullInjectorError: No provider for Platform!
Error: StaticInjectorError(AppModule)[PhoneService -> Platform]: 
  StaticInjectorError(Platform: core)[PhoneService -> Platform]: 
    NullInjectorError: No provider for Platform!
    at _NullInjector.get (http-loader.ts:15)
    at resolveToken (http-loader.ts:15)
    at tryResolveToken (http-loader.ts:15)
    at StaticInjector.get (http-loader.ts:15)
    at resolveToken (http-loader.ts:15)
    at tryResolveToken (http-loader.ts:15)
    at StaticInjector.get (http-loader.ts:15)
    at resolveNgModuleDep (http-loader.ts:15)
    at NgModuleRef_.get (http-loader.ts:15)
    at resolveDep (http-loader.ts:15)
    at _NullInjector.get (http-loader.ts:15)
    at resolveToken (http-loader.ts:15)
    at tryResolveToken (http-loader.ts:15)
    at StaticInjector.get (http-loader.ts:15)
    at resolveToken (http-loader.ts:15)
    at tryResolveToken (http-loader.ts:15)
    at StaticInjector.get (http-loader.ts:15)
    at resolveNgModuleDep (http-loader.ts:15)
    at NgModuleRef_.get (http-loader.ts:15)
    at resolveDep (http-loader.ts:15)
    at resolvePromise (http-loader.ts:15)
    at Object.reject (http-loader.ts:15)
    at Nav._fireError (http-loader.ts:15)
    at Nav._failed (http-loader.ts:15)
    at http-loader.ts:15
    at ZoneDelegate.invoke (http-loader.ts:15)
    at Object.onInvoke (http-loader.ts:15)
    at ZoneDelegate.invoke (http-loader.ts:15)
    at Zone.run (http-loader.ts:15)
    at http-loader.ts:15

the code in phone.ts

import {Injectable} from '@angular/core';
import {Platform} from 'ionic-angular';
import {Accounts} from "meteor/accounts-base";
import {Meteor} from 'meteor/meteor';

@Injectable()

export class PhoneService {
    constructor(private platform: Platform) {}
    verify(phoneNumber: string): Promise<void> {
        return new Promise<void>((resolve, reject) => {
            Accounts.requestPhoneVerification(phoneNumber, (e: Error) => {
                if (e) {
                    return reject(e);
                }
                resolve();
            });
        });
    }
    login(phoneNumber: string, code: string): Promise<void> {
        return new Promise<void>((resolve, reject) => {
            Accounts.verifyPhone(phoneNumber, code, (e: Error) => {
                if (e) {
                    return reject(e);
                }
                resolve();
            });
        });
    }
    logout(): Promise<void> {
        return new Promise<void>((resolve, reject) => {
            Meteor.logout((e: Error) => {
                if (e) {
                    return reject(e);
                }
                resolve();
            });
        });
    }
}

In server/main.ts

import { Main } from "./imports/server-main/main";
import { Accounts } from 'meteor/accounts-base';
import { Meteor } from 'meteor/meteor';

const mainInstance = new Main();
mainInstance.start();

Meteor.startup(() => {
    if (Meteor.settings) {
        Object.assign(Accounts._options, Meteor.settings['accounts-phone']);
        SMS.twilio = Meteor.settings['twilio'];
    }
});

And in app.module.ts

 providers: [
        DemoDataService,
        {
            provide: ErrorHandler,
            useClass: IonicErrorHandler
        },
        PhoneService,
        SplashScreen,
        StatusBar
    ],

Meteor version is 1.6.1.1

Can somebody help me please?