This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { Observable, of, throwError } from 'rxjs'; | |
import { HttpClient, HttpHeaders, HttpErrorResponse } from '@angular/common/http'; | |
import { catchError, tap, map } from 'rxjs/operators'; | |
const httpOptions = { | |
headers: new HttpHeaders({'Content-Type': 'application/json'}) | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Hash the password before we even save it to the database | |
UserSchema.pre('save', function(next) { | |
let user = this; | |
if (!user.isModified('local.password')) | |
return next(); | |
bcrypt.genSalt(10, function(err, salt) { | |
if (err) | |
return next(err); | |
bcrypt.hash(user.local.password, salt, null, function(err, hash) { | |
if (err) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit } from '@angular/core'; | |
import { LoadingController } from '@ionic/angular'; | |
import { RestService } from '../rest.service'; | |
import { ActivatedRoute, ParamMap } from '@angular/router'; | |
@Component({ | |
selector: 'app-view', | |
templateUrl: './view.page.html', | |
styleUrls: ['./view.page.scss'], | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getAllTodos(req, res) { | |
const Todo = require('../../todo/models'); | |
Todo.find({}, function(err, todos) { | |
if (err) throw err; | |
res.json(todos); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// set the dimensions and margins of the graph | |
var width = 450 | |
height = 450 | |
margin = 40 | |
// The radius of the pieplot is half the width or half the height (smallest one). I subtract a bit of margin. | |
var radius = Math.min(width, height) / 2 - margin | |
// append the svg object to the div called 'my_dataviz' | |
var svg = d3.select("#graph") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit } from '@angular/core'; | |
import { LoadingController } from '@ionic/angular'; | |
import { RestService } from '../rest.service'; | |
import { ActivatedRoute, ParamMap } from '@angular/router'; | |
@Component({ | |
selector: 'app-view', | |
templateUrl: './view.page.html', | |
styleUrls: ['./view.page.scss'], | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ion-header> | |
<ion-toolbar> | |
<ion-buttons slot="start"> | |
<ion-menu-button></ion-menu-button> | |
</ion-buttons> | |
<ion-title> | |
Todos List | |
</ion-title> | |
<ion-buttons slot="end"> | |
<ion-button routerLink="/add" routerDirection="forward"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component } from '@angular/core'; | |
import { LoadingController, NavController } from '@ionic/angular'; | |
import { RestService } from '../rest.service'; | |
@Component({ | |
selector: 'app-home', | |
templateUrl: 'home.page.html', | |
styleUrls: ['home.page.scss'], | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { Observable, of, throwError } from 'rxjs'; | |
import { HttpClient, HttpHeaders, HttpErrorResponse } from '@angular/common/http'; | |
import { catchError, tap, map } from 'rxjs/operators'; | |
const httpOptions = { | |
headers: new HttpHeaders({'Content-Type': 'application/json'}) | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ion-list> | |
<ion-item-sliding #item> | |
<ion-item> | |
Laundry | |
</ion-item> | |
<ion-item-options side="start"> | |
<button ion-button color="light">Done</button> | |
</ion-item-options> | |
<ion-item-options side="end"> | |
<button ion-button color="light">Edit</button> |
NewerOlder