Geolocation map, blanc in Ionic2 - ionic-framework

I want to create an map in my application to show my location with a marker.
I'm using ionic 2 but got blanco page:
http://prntscr.com/dx5czu
This is my code in map.html:
<ion-header>
<ion-navbar>
<button ion-button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
<ion-title>Map</ion-title>
</ion-navbar>
</ion-header>
<ion-content>
<ion-buttons end>
<button ion-button (click)="addMarker()"><ion-icon name="add"></ion-icon>Add Marker</button>
</ion-buttons>
<div #map id="map"></div>
</ion-content>
And my code in map.ts:
import { Component, ViewChild, ElementRef } from '#angular/core';
import { NavController } from 'ionic-angular';
import { Geolocation } from 'ionic-native';
declare var google;
#Component({
selector: 'page-map',
templateUrl: 'map.html'
})
export class Map {
#ViewChild('map') mapElement: ElementRef;
map: any;
constructor(public navCtrl: NavController) {
}
ionViewDidLoad(){
this.loadMap();
}
loadMap(){
Geolocation.getCurrentPosition().then((position) => {
let latLng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
let mapOptions = {
center: latLng,
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
this.map = new google.maps.Map(this.mapElement.nativeElement, mapOptions);
}, (err) => {
console.log(err);
});
}
addMarker(){
let marker = new google.maps.Marker({
map: this.map,
animation: google.maps.Animation.DROP,
position: this.map.getCenter()
});
let content = "<h4>Information!</h4>";
this.addInfoWindow(marker, content);
}
addInfoWindow(marker, content){
let infoWindow = new google.maps.InfoWindow({
content: content
});
google.maps.event.addListener(marker, 'click', () => {
infoWindow.open(this.map, marker);
});
}
}
There are no errors given.

This plugin just wordk in device mobile

The thing is your code is perfect except the following lines
ionViewDidLoad(){
this.loadMap(); }
ionViewDidLoad is in the old version of ionic. To make it working you can push this.loadMap(); in the constructor. So the new code will look like
constructor(public navCtrl: NavController) {
this.loadMap();
}
For more information, you can visit my github repository https://github.com/darpanpathak/LocationTrackerApp

Related

Problem with Camera Preview Plugin (ionic 3): Object(...) is not a function at CameraPreview.startCamera

I'm developing an ionic 3 application in which I need to show the camera interface inside the app screen and camera-preview seems to be the right and only solution to go with at this moment. However, when I trigger the startCamera function, I always get the error ' Object(...) is not a function at CameraPreview.startCamera'. Any help would be much appreciated.
Here are the steps I used for the installation:
From CLI:
ionic cordova plugin add https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview.git
npm install #ionic-native/camera-preview
2.Add to the provider list in module.ts file
import { CameraPreview } from '#ionic-native/camera-preview/ngx';
.....
providers: [
CameraPreview, ...
]
Below is the page where I would use the plugin:
import { Component, NgZone } from '#angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { CameraPreview, CameraPreviewPictureOptions, CameraPreviewOptions, CameraPreviewDimensions } from '#ionic-native/camera-preview/ngx';
#Component({
selector: 'page-submitdata2',
templateUrl: 'submitdata2.html',
})
export class Submitdata2Page {
public getWidth: number;
public getHeight: number;
public calcWidth: number;
cameraPreviewOpts: CameraPreviewOptions =
{
x: 40,
y: 100,
width: 220,
height: 220,
toBack: false,
previewDrag: true,
tapPhoto: true,
camera: this.cameraPreview.CAMERA_DIRECTION.BACK
}
constructor(
public cameraPreview: CameraPreview, private zone: NgZone,
public navCtrl: NavController, public navParams: NavParams) {
this.zone.run(() => {
this.getWidth = window.innerWidth;
this.getHeight = window.innerHeight;
});
console.log('width', this.getWidth);
this.calcWidth = this.getWidth - 80;
console.log('calc width', this.calcWidth);
}
ionViewDidLoad() {
console.log('ionViewDidLoad Submitdata2Page');
}
startCamera() {
debugger
this.cameraPreview.startCamera(this.cameraPreviewOpts).then(
(res) => {
console.log(res)
},
(err) => {
console.log(err)
});
}
stopCamera() {
this.cameraPreview.stopCamera();
}
takePicture() {
this.cameraPreview.takePicture()
.then((imgData) => {
(<HTMLInputElement>document.getElementById('previewPicture')).src = 'data:image/jpeg;base64,' + imgData;
});
}
SwitchCamera() {
this.cameraPreview.switchCamera();
}
showCamera() {
this.cameraPreview.show();
}
hideCamera() {
this.cameraPreview.hide();
}
}
The HTML:
<ion-header>
<ion-navbar>
<ion-title>Preview Page</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
<h5>This is camera Preview Application..</h5>
<div class="displaybottom">
<button ion-button (click)="startCamera()"> Start Camera</button>
<button ion-button (click)="stopCamera()"> Stop Camera</button>
<button ion-button (click)="takePicture()"> Take Picture Camera</button>
<button ion-button (click)="SwitchCamera()"> Switch Camera</button>
<button ion-button (click)="showCamera()"> Show Camera</button>
<button ion-button (click)="hideCamera()"> Hide Camera</button>
</div>
<div class="pictures">
<p><img id="previewPicture" width="200" /></p>
<!--<p><img id="originalPicture" width="200"/></p>-->
</div>
</ion-content>
My Development Enviroment:

Ionic 4 background blinks and tap delay

This is my first application using ionic4 and there is something weird happening. When I tap on any link, there is delay and the entire background blinks before it loads the page. Here is a video showing this weird behave: https://youtu.be/NqoOMQYyr4k
For reference, here is the code for the pages:
On the global.scss i have this property to setup the background
ion-content {
--background: #000 url('./assets/images/main-bg.png') no-repeat center center / cover;
}
news.page.ts
import { News } from './news.model';
import { Component, OnInit } from '#angular/core';
import { NewsService } from '../services/news.service';
import { Router } from '#angular/router';
import { NavController } from '#ionic/angular';
#Component({
selector: 'app-news',
templateUrl: './news.page.html',
styleUrls: ['./news.page.scss'],
})
export class NewsPage implements OnInit {
news: any;
constructor(private newsService: NewsService, private router: Router, private navController: NavController) { }
ngOnInit() {
this.news = this.newsService.getAllEvents();
}
go(id: string) {
this.navController.navigateForward('news/' + id);
}
}
news.page.html
<ion-header>
<ion-toolbar color="grey">
<ion-buttons slot="start">
<ion-menu-button></ion-menu-button>
</ion-buttons>
<ion-title style="color: #524A4A!important">News</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-grid padding class="margin-logo-header">
<ion-row>
<div>
<h2>Noticias HD Friends</h2>
</div>
</ion-row>
</ion-grid>
<ion-card color="grey" *ngFor="let news of news | async">
<ion-nav-pop (click)="go(news.id)" >
<ion-img src="{{news.picture}}"></ion-img>
<ion-card-header>
<ion-card-title>{{ news.title }}</ion-card-title>
</ion-card-header>
<ion-card-content>
<p>{{ news.subtitle }}</p>
</ion-card-content>
</ion-nav-pop>
</ion-card>
</ion-content>
news.service.ts
import { Injectable } from '#angular/core';
import { AngularFireDatabase, AngularFireList } from '#angular/fire/database';
import { News } from '../news/news.model';
#Injectable({
providedIn: 'root'
})
export class NewsService {
NODE = 'news/';
news: AngularFireList<News[]>;
constructor(private db: AngularFireDatabase) { }
getAllEvents() {
const localNews = this.db.list(this.NODE);
return localNews.valueChanges();
}
getNews(id: string) {
return this.db.object(this.NODE + id);
}
}
Is this a bug because it's a beta or is this something I messed up?
Thanks guys
UPDATE 1
This seems to be a bug on ionic framework. As soon as I get something I'll post here for future reference.

How to get modal data on modal dismiss in Ionic 3?

I have a Page with a List. From that page I open a MODAL.
That modal contains a Text box and a Add Item Button.
When I enter an Item in the Box and Hit Add Item, I need to
1) Dismiss the Modal
2) Add the entered Item in the List in the Previous List
I need to do this via On Dismiss().
HOME.HTML
<ion-header>
<ion-navbar>
<ion-title>
Ionic Blank
</ion-title>
</ion-navbar>
</ion-header>
<ion-content>
<ion-list>
<ion-item *ngFor="let grocery of itemsArray">{{grocery}}</ion-item>
</ion-list>
<button ion-button round (click)="addItem()">Add Item</button>
</ion-content>
HOME.TS
export class HomePage {
public itemsArray = [];
newItem: String;
constructor(public navCtrl: NavController, public modalCtrl: ModalController, public navParams: NavParams) {
}
ionViewDidLoad() {
this.newItem = this.navParams.get('data');
this.itemsArray = [
'Bread',
'Milk',
'Cheese',
'Snacks',
'Apples',
'Bananas',
'Peanut Butter',
'Chocolate',
'Avocada',
'Vegemite',
'Muffins',
'Paper towels'
];
this.itemsArray.push(this.newItem)
}
public addItem() {
let modalPage = this.modalCtrl.create(ModalPage);
modalPage.onDidDismiss(data => {
this.newItem = data;
});
modalPage.present();
}
}
MODAL.HTML
<ion-header>
<ion-navbar>
<ion-title>Add Item</ion-title>
<ion-buttons end>
<button ion-button (click)="closeModal()">Close</button>
</ion-buttons>
</ion-navbar>
</ion-header>
<ion-content padding>
<ion-list>
<ion-item>
<ion-label>Item</ion-label>
<ion-input type="text" [(ngModel)]="newItem"></ion-input>
</ion-item>
<button ion-button color="secondary" (click)="add()">Add Item</button>
</ion-list>
</ion-content>
MODAL.TS
export class ModalPage {
name:any;
constructor(public navCtrl: NavController, public viewCtrl: ViewController, public navParams: NavParams) {
}
ionViewDidLoad() {
console.log('ionViewDidLoad ModalPage');
}
public closeModal() {
this.viewCtrl.dismiss();
}
add() {
let data = {"name": this.name};
this.viewCtrl.dismiss(data)
}
}
Your code seems to be fine overall.
Change this part.
public addItem() {
let modalPage = this.modalCtrl.create(ModalPage);
modalPage.onDidDismiss(data => {
this.itemsArray.push(data);
});
modalPage.present();
}
Change the name of your variable on the html or the TS file.
name to newItem or vice-versa
You are using [(ngModel)]="newItem" but in your TS file your using this.name
You're adding the item on ionViewDidLoad() but the new item arrives at modalPage.onDidDismiss()
Give it a try. I'll help you further if it still does not work.
First you need to pass object/string of item/data from you mode while you are closing the same
this.viewCtrl.dismiss(data);
And you have to subscribe model closing event at the page from where you have opened it for ex.
let modal = this.modalCtrl.create(ModelPage);
modal.onDidDismiss(data => {
this.badge = data;
});
modal.present();
After you can simply push you new item in to items array :)

Ionic Http request re-occurring multiple times

I'm learning Ionic and stuck on an issue. My app is stuck in a loop in which it is repeatedly fetching information from a remote server and causing the browser and crash.
I setup a service, code below, to retrieve the data:
import { HttpClient } from '#angular/common/http';
import { Injectable } from '#angular/core';
/*
Generated class for the CategoriesServiceProvider provider.
See https://angular.io/guide/dependency-injection for more info on providers
and Angular DI.
*/
#Injectable()
export class CategoriesServiceProvider {
apiURL = 'https://reqres.in/api/users';
constructor(public http: HttpClient) {
console.log('Hello CategoriesServiceProvider Provider');
}
getUsers(){
return new Promise(resolve => {
this.http.get(this.apiURL).subscribe(data => {
resolve(data);
// console.log(data);
}, err => {
console.error(err);
});
});
}
}
Below is the code in my categories.ts file which uses the service above:
import { Component } from '#angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { CategoriesServiceProvider } from '../../providers/categories-service/categories-service';
/**
* Generated class for the CategoriesPage page.
*
* See https://ionicframework.com/docs/components/#navigation for more info on
* Ionic pages and navigation.
*/
#IonicPage()
#Component({
selector: 'page-categories',
templateUrl: 'categories.html',
providers: [CategoriesServiceProvider]
})
export class CategoriesPage {
constructor(public navCtrl: NavController, public navParams: NavParams, private categories: CategoriesServiceProvider) {
}
users: any;
getUsers(){
this.categories.getUsers().then(data => {
this.users = data;
console.log(this.users);
});
}
ionViewDidLoad() {
console.log('ionViewDidLoad CategoriesPage');
this.getUsers();
}
}
... followed by categories.html:
<ion-header>
<ion-navbar>
<ion-title>categories</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
<ion-list>
<ion-item *ngFor="let user of getUsers()">
TESTING - {{user.gender}}
</ion-item>
</ion-list>
</ion-content>
I don't know why the http request is repeating instead of fetching once and then going away.
here you are looping on the function to get your data:
<ion-content padding>
<ion-list>
<ion-item *ngFor="let user of getUsers()">
TESTING - {{user.gender}}
</ion-item>
</ion-list>
</ion-content>
Replace it with the retrieved data instead!
Something like :
<ion-content padding>
<ion-list>
<ion-item *ngFor="let user of this.users">
TESTING - {{user.gender}}
</ion-item>
</ion-list>
</ion-content>

Angular 2 reactive nested form

I have a nested form created for an ionic project, in which I have formGroups that contain formArray, and each formArray has one or more formGroups, itself.
The process of saving data works great. I can have as many formArrays with as many formGroups as I like.
My problem is when I am trying to populate the form with a saved data. I cannot add correctly the data inside the formArrays.
This is my edit script:
import { Component } from '#angular/core';
import { FormBuilder, FormControl, FormArray, FormGroup, Validators } from '#angular/forms';
import { NavController, NavParams } from 'ionic-angular';
import { Todos } from '../../providers/todos';
import { HomePage } from '../home/home';
import { Patient } from '../../interfaces/patient.interface';
#Component({
selector: 'page-edit',
templateUrl: 'edit.html'
})
export class EditPage {
patient: any;
patientDate: any;
editTodoForm: FormGroup;
submitted: boolean;
events: any[] = [];
constructor(public navCtrl: NavController, public todoService: Todos, public navParams: NavParams, public formBuilder: FormBuilder) {
this.patient = this.navParams.data;
this.patientDate = new Date(this.patient.date).toISOString();
this.editTodoForm = formBuilder.group({
_id: [this.patient._id],
_rev: [this.patient._rev],
firstName: [this.patient.firstName, Validators.compose([Validators.pattern('[a-zA-Z ]*'), Validators.required])],
date: [this.patientDate],
botoxes: this.formBuilder.array([]),
acids: this.formBuilder.array([])
});
this.subcribeToFormChanges();
this.addBotox();
this.addAcid();
}
ionViewDidLoad() {
console.log('ionViewDidLoad EditPage');
this.editTodoForm.setValue(this.patient);
}
initBotox() {
return this.formBuilder.group({
botoxDate: [''],
botoxTypes: this.formBuilder.array([
this.formBuilder.group({
botoxType: [''],
botoxZone: [''],
botoxUnit: ['']
})
])
});
}
addBotox() {
const control = <FormArray>this.editTodoForm.controls['botoxes'];
const botoxCtrl = this.initBotox();
if(this.patient.botoxes) {
this.patient.botoxes.forEach(botox => {
control.push(botoxCtrl);
})
} else {
control.push(botoxCtrl);
}
}
removeBotox(i: number) {
const control = <FormArray>this.editTodoForm.controls['botoxes'];
control.removeAt(i);
}
initAcid() {
return this.formBuilder.group({
acidDate: [''],
acidTypes: this.formBuilder.array([
this.formBuilder.group({
acidType: [''],
acidZone: [''],
acidUnit: ['']
})
])
});
}
addAcid() {
const control = <FormArray>this.editTodoForm.controls['acids'];
const acidCtrl = this.initAcid();
control.push(acidCtrl);
}
removeAcid(i: number) {
const control = <FormArray>this.editTodoForm.controls['acids'];
control.removeAt(i);
}
subcribeToFormChanges() {
const myFormStatusChanges$ = this.editTodoForm.statusChanges;
const myFormValueChanges$ = this.editTodoForm.valueChanges;
myFormStatusChanges$.subscribe(x => this.events.push({ event: 'STATUS_CHANGED', object: x }));
myFormValueChanges$.subscribe(x => this.events.push({ event: 'VALUE_CHANGED', object: x }));
}
updateTodo(model: Patient, isValid: boolean) {
this.submitted = true;
this.todoService.updateTodo(this.editTodoForm.value);
this.navCtrl.setRoot(HomePage);
}
}
This is the edit html:
<ion-header no-border>
<ion-navbar color="primary">
<ion-title>Editeaza pacient</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
<form [formGroup]="editTodoForm" novalidate>
<div [hidden]="editTodoForm.controls.firstName.valid || (editTodoForm.controls.firstName.pristine && !submitted)" class="error-notification">
Pacientul trebuie sa aiba cel putin un nume si un prenume
</div>
<ion-card>
<ion-card-header>
Date personale
</ion-card-header>
<ion-list padding>
<ion-item>
<ion-label stacked>Prenume pacient</ion-label>
<ion-input type="text" formControlName="firstName"></ion-input>
</ion-item>
<ion-item>
<ion-label stacked>Dată activitate</ion-label>
<ion-datetime displayFormat="DD MMMM YYYY" pickerFormat="DD MMMM YYYY" formControlName="date"
monthNames="ianuaie, februarie, martie, aprilie, mai, iunie, iulie, august, septembrie, octombrie, noiembrie, decembrie"></ion-datetime>
</ion-item>
</ion-list>
</ion-card>
<ion-card>
<ion-card-header>
Tratamente botox
</ion-card-header>
<ion-list padding>
<ion-card formArrayName="botoxes">
<div *ngFor="let botox of editTodoForm.controls.botoxes.controls; let i=index">
<p class="card-heading">
<span>Tratament cu botox {{i + 1}}</span>
<button ion-button icon-only *ngIf="editTodoForm.controls.botoxes.controls.length > 1" (click)="removeBotox(i)" class="right-button remove-button">
<ion-icon name="trash"></ion-icon>
</button>
</p>
<div [formGroupName]="i">
<botoxInputs [group]="editTodoForm.controls.botoxes.controls[i]"></botoxInputs>
</div>
</div>
</ion-card>
<button (click)="addBotox()" ion-button icon-left>
<ion-icon name="add"></ion-icon>
Adauga tratament cu botox
</button>
</ion-list>
</ion-card>
<ion-card>
<ion-card-header>
Tratamente acid hialuronic
</ion-card-header>
<ion-list padding>
<ion-card formArrayName="acids">
<div *ngFor="let acid of editTodoForm.controls.acids.controls; let i=index">
<p class="card-heading">
<span>Tratament cu acid hialuronic {{i + 1}}</span>
<button ion-button icon-only *ngIf="editTodoForm.controls.acids.controls.length > 1" (click)="removeAcid(i)" class="right-button remove-button">
<ion-icon name="trash"></ion-icon>
</button>
</p>
<div [formGroupName]="i">
<acidInputs [group]="editTodoForm.controls.acids.controls[i]"></acidInputs>
</div>
</div>
</ion-card>
<button (click)="addAcid()" ion-button icon-left>
<ion-icon name="add"></ion-icon>
Adauga tratament cu acid hialuronic
</button>
</ion-list>
</ion-card>
<div padding>
<button ion-button color="primary" block type="submit" (click)="createPatient(editTodoForm, editTodoForm.valid)">Salveaza date pacient</button>
</div>
</form>
</ion-content>
And this is an example of a saved JSON I am trying to add back to the form:
{
"firstName": "Ionescu Ion",
"date": "2017-02-01T00:00:00.000Z",
"botoxes": [{
"botoxDate": "2017-02-01",
"botoxTypes": [{
"botoxType": "Xeomin 100UI",
"botoxZone": ["Frunte", "Crow feet", "Sprânceană"],
"botoxUnit": "111"
}, {
"botoxType": "Azzalure 50UI",
"botoxZone": ["Glabelar", "Intersprincenos", "Frunte"],
"botoxUnit": "222"
}]
}],
"acids": [{
"acidDate": "2017-02-01",
"acidTypes": [{
"acidType": "Juvederm Volift",
"acidZone": ["Periocular", "Tâmple"],
"acidUnit": "0.5 ml"
}]
}],
"_id": "0A418E81-CFD0-545B-B8DB-A326CECFC5F1",
"_rev": "3-f2914e24db5fac42930dba548f418cbd"
}
My problem is that I can get only on e botoxType displayed of the two botoxTypes.
I would really appreciate any help
For anyone having the same issues as I had. This is how I changed my edit script to set initial values properly on formArrays:
import { Component } from '#angular/core';
import { FormBuilder, FormArray, FormGroup, Validators } from '#angular/forms';
import { NavController, NavParams } from 'ionic-angular';
import { Todos } from '../../providers/todos';
import { HomePage } from '../home/home';
import { Patient } from '../../interfaces/patient.interface';
#Component({
selector: 'page-edit',
templateUrl: 'edit.html'
})
export class EditPage {
patient: any;
editTodoForm: FormGroup;
submitted: boolean;
events: any[] = [];
constructor(public navCtrl: NavController, public todoService: Todos, public navParams: NavParams, public formBuilder: FormBuilder) {
this.patient = this.navParams.data;
this.editTodoForm = formBuilder.group({
_id: [this.patient._id],
_rev: [this.patient._rev],
firstName: ['', Validators.compose([Validators.pattern('[a-zA-Z ]*'), Validators.required])],
date: [''],
botoxes: this.formBuilder.array([]),
acids: this.formBuilder.array([])
});
this.subcribeToFormChanges();
if(this.patient.botoxes.length > 0) {
this.patient.botoxes.forEach(botox => {
let btys = botox.botoxTypes.length;
this.addBotox(btys);
});
} else {
this.addBotox(1);
}
if(this.patient.acids.length > 0) {
this.patient.acids.forEach(acid => {
let atys = acid.acidTypes.length;
this.addAcid(atys);
});
} else {
this.addAcid(1);
}
}
ionViewDidLoad() {
console.log('ionViewDidLoad EditPage');
const value: Patient = this.navParams.data;
(<FormGroup>this.editTodoForm).patchValue(value, { onlySelf: true });
}
initBotox(number) {
return this.formBuilder.group({
botoxDate: [''],
botoxTypes: this.addBotoxTypes(number)
});
}
initBotoxTypes() {
return this.formBuilder.group({
botoxType: [''],
botoxZone: [''],
botoxUnit: ['']
});
}
addBotoxTypes(number) {
let bts = new FormArray([]);
for(let i = 0; i < number; i++) {
bts.push(this.initBotoxTypes())
}
return bts;
}
addBotox(number) {
const control = <FormArray>this.editTodoForm.controls['botoxes'];
const botoxCtrl = this.initBotox(number);
control.push(botoxCtrl);
}
removeBotox(i: number) {
const control = <FormArray>this.editTodoForm.controls['botoxes'];
control.removeAt(i);
}
initAcid(number) {
return this.formBuilder.group({
acidDate: [''],
acidTypes: this.addAcidTypes(number)
});
}
initAcidTypes() {
return this.formBuilder.group({
acidType: [''],
acidZone: [''],
acidUnit: ['']
});
}
addAcidTypes(number) {
let acs = new FormArray([]);
for(let i = 0; i < number; i++) {
acs.push(this.initAcidTypes())
}
return acs;
}
addAcid(number) {
const control = <FormArray>this.editTodoForm.controls['acids'];
const acidCtrl = this.initAcid(number);
control.push(acidCtrl);
}
removeAcid(i: number) {
const control = <FormArray>this.editTodoForm.controls['acids'];
control.removeAt(i);
}
subcribeToFormChanges() {
const myFormStatusChanges$ = this.editTodoForm.statusChanges;
const myFormValueChanges$ = this.editTodoForm.valueChanges;
myFormStatusChanges$.subscribe(x => this.events.push({ event: 'STATUS_CHANGED', object: x }));
myFormValueChanges$.subscribe(x => this.events.push({ event: 'VALUE_CHANGED', object: x }));
}
updateTodo(model: Patient, isValid: boolean) {
this.submitted = true;
this.todoService.updateTodo(this.editTodoForm.value);
this.navCtrl.setRoot(HomePage);
}
}