· 6 years ago · Jun 19, 2019, 12:04 AM
1</div>
2<ion-list>
3 <ion-item>
4 <ion-input type="text" placeholder="Nome" [(ngModel)]="entry.name" clearInput ></ion-input>
5 </ion-item>
6 <ion-item>
7 <ion-input type="tel" name="phone" placeholder="Celular" [brmasker]="{phone: true}" [(ngModel)]="entry.celular" clearInput ></ion-input>
8 </ion-item>
9</ion-list>
10<ion-item>
11 <ion-textarea rows="3" cols="10" placeholder="Deixe aqui comentários e sugestões..." [(ngModel)]="entry.description"></ion-textarea>
12</ion-item>
13
14export class HomePage {
15
16this.account
17 .addEntry(name)
18 .then(() => console.log('registro inserido'));
19
20import { Injectable } from '@angular/core';
21
22//this.dropTables();
23 this.createTables();
24 this.insertBD(db);
25})
26.catch(e => console.error('error on load db', JSON.stringify(e)));
27
28this.dbConection.sqlBatch([
29 "CREATE TABLE IF NOT EXISTS pesquisa( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT);"
30])
31.then(() => console.log('tables created successfully'))
32.catch(e => console.error('error on creating tables', JSON.stringify(e)));
33
34if (data.rows.item(0).qtd == 0) {
35 db.sqlBatch([
36 ['INSERT INTO pesquisa (name) VALUES (?)']
37 ])
38 .then(() => console.log('Dados pesquisa incluídos com sucesso!'))
39 .catch(e => console.error('Erro ao incluir os dados default', e));
40 }
41 })
42 .catch(e => console.error('Erro ao consultar a qtd em pesquisa', JSON.stringify(e)));
43
44this.dbConection.sqlBatch([
45 ["DROP TABLE pesquisa"]
46])
47.then(() => console.log('tables droped successfully'))
48.catch(e => console.error('error on drop tables', JSON.stringify(e)));
49
50this.nome = navParams.get('name');