Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Vibration

Boa tarde meu código está dando esse erro :

TypeError: Function expected at Vibration.prototype.vibrate (http://localhost:8100/build/vendor.js:69438:53) at CadastroPage.prototype.agenda (http://localhost:8100/build/main.js:208:13) at Anonymous function (Function code:44:11) at handleEvent (http://localhost:8100/build/vendor.js:12380:87) at callWithDebugContext (http://localhost:8100/build/vendor.js:13850:9) at debugHandleEvent (http://localhost:8100/build/vendor.js:13438:5) at dispatchEvent (http://localhost:8100/build/vendor.js:8972:5) at Anonymous function (http://localhost:8100/build/vendor.js:11140:13) at Anonymous function (http://localhost:8100/build/vendor.js:4004:36) at SafeSubscriber.prototype.__tryOrUnsub (http://localhost:8100/build/vendor.js:28989:13)

Sendo que eu importei : import { Vibration } from '@ionic-native/vibration/ngx';

Meu contrutor:

constructor(public navCtrl: NavController, public navParams: NavParams, private _alertCtrl: AlertController, private _agendamentosService: AgendamentosServiceProvider, private _agendamentoDao: AgendamentoDaoProvider , private _vibration: Vibration ) {

Metodo agenda:

agenda() { if (!this.nome || !this.endereco || !this.email) {

  this._vibration.vibrate(1000);

  this._alertCtrl.create({
    title: 'Preenchimento obrigatório',
    subTitle: 'Preencha todos os campos!',
    buttons: [
      { text: 'ok' }
    ]
  }).present();

  return;
}
1 resposta
solução!

Boa tarde, Allan! Como vai?

Se vc está seguindo o projeto do curso da forma como ele está sendo apresentado, então a importação que vc fez foi incorreta! O certo era fazer a importação de:

import { Vibration } from '@ionic-native/vibration';

Isso é visto nessa aula!

Pegou a ideia? Qualquer coisa é só falar!

Grande abraço e bons estudos, meu aluno!