Skip to content

Instantly share code, notes, and snippets.

View shafiqshams's full-sized avatar
😇
Its ok to fail, everyone fails, failure is not opposite of success, its a part.

Shafiq Shams shafiqshams

😇
Its ok to fail, everyone fails, failure is not opposite of success, its a part.
View GitHub Profile
@shafiqshams
shafiqshams / location.ts
Created November 22, 2017 15:06 — forked from cod3cow/location.ts
start external map navigation from ionic 2 app for ios and android; needs cordova-plugin-geolocation
startExternalMap() {
if (this.location.latitude) {
this.platform.ready().then(() => {
Geolocation.getCurrentPosition().then((position) => {
// ios
if (this.platform.is('ios')) {
window.open('maps://?q=' + this.location.name + '&saddr=' + position.coords.latitude + ',' + position.coords.longitude + '&daddr=' + this.location.latitude + ',' + this.location.longitude, '_system');
};
// android
if (this.platform.is('android')) {
@shafiqshams
shafiqshams / validation.component.ts
Last active February 22, 2018 20:13
Sandbox Component for Template Driven Forms Validation
import { Component } from '@angular/core';
@Component({
selector:'sandbox',
template:`
<h1>Hello World</h1>
<form novalidate #f="ngForm" (ngSubmit)="onSubmit(f)">
<div class="form-group">
<label>Name</label>
<input
@shafiqshams
shafiqshams / mouse.component.ts
Created February 22, 2018 20:18
Mouse Events Ionic 2
import { Component } from '@angular/core';
@Component({
selector:'sandbox',
template:`
<h1>Hello World</h1>
<button id="btn" (click)="fireEvent($event)">Click Event</button>
<br>
<button id="btn" (mouseover)="fireEvent($event)">Mouseover Event</button>
<br>
@shafiqshams
shafiqshams / keyboard.component.ts
Created February 22, 2018 20:22
Keyboard Events Ionic 2
import { Component } from '@angular/core';
@Component({
selector:'sandbox',
template:`
<h1>Hello World</h1>
<div>
<input type="text" (keyup)="fireEvent($event)" placeholder="keyup event">
</div>
<div>
@shafiqshams
shafiqshams / crud.component.ts
Created February 22, 2018 20:33
CRUD with HTTP Methods
import { Component } from '@angular/core';
import { DataService } from '../../services/data.service';
@Component({
selector:'sandbox',
template:`
<h1>Hello World</h1>
<form (submit)="onSubmit(isEdit)">
<div class="form-group">
<label>Name</label>