This file contains hidden or 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
//Use this directive to open external links using inAppBrowser cordova plugin | |
.directive('dynamicAnchorFix', function($ionicGesture, $timeout, $cordovaInAppBrowser) { | |
return { | |
scope: {}, | |
link: function(scope, element, attrs) { | |
$timeout(function(){ | |
var anchors = element.find('a'); | |
if(anchors.length > 0) | |
{ | |
angular.forEach(anchors, function(a) { |
This file contains hidden or 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
/* global FB */ | |
"use strict"; | |
/* | |
* @author Ally Ogilvie | |
* @copyright Wizcorp Inc. [ Incorporated Wizards ] 2014 | |
* @file - facebookConnectPlugin.js | |
* @about - JavaScript interface for PhoneGap bridge to Facebook Connect SDK | |
* | |
* |
This file contains hidden or 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
this.createPost = function() { | |
var deferred = $q.defer(), | |
nonce_dfd = $q.defer(); | |
AuthService.requestNonce("posts", "create_post") | |
.then(function(nonce){ | |
nonce_dfd.resolve(nonce); | |
}); | |
nonce_dfd.promise.then(function(nonce){ |
This file contains hidden or 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 { Pipe, PipeTransform } from '@angular/core'; | |
@Pipe({name: 'slugify'}) | |
export class SlugifyPipe implements PipeTransform { | |
transform(input: string): string { | |
return input.toString().toLowerCase() | |
.replace(/\s+/g, '-') // Replace spaces with - | |
.replace(/[^\w\-]+/g, '') // Remove all non-word chars | |
.replace(/\-\-+/g, '-') // Replace multiple - with single - | |
.replace(/^-+/, '') // Trim - from start of text |
This file contains hidden or 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 { AbstractControl, ValidatorFn } from '@angular/forms'; | |
import libphonenumber from 'google-libphonenumber'; | |
export class PhoneValidator { | |
// Inspired on: https://github.com/yuyang041060120/ng2-validation/blob/master/src/equal-to/validator.ts | |
static validCountryPhone = (countryControl: AbstractControl): ValidatorFn => { | |
let subscribe: boolean = false; | |
return (phoneControl: AbstractControl): {[key: string]: boolean} => { |
This file contains hidden or 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 { FormControl, FormGroup } from '@angular/forms'; | |
export class PasswordValidator { | |
static areEqual(formGroup: FormGroup) { | |
let val; | |
let valid = true; | |
for (let key in formGroup.controls) { | |
if (formGroup.controls.hasOwnProperty(key)) { | |
let control: FormControl = <FormControl>formGroup.controls[key]; |
This file contains hidden or 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 { PasswordValidator } from '../../validators/password.validator'; | |
this.matching_passwords_group = new FormGroup({ | |
password: new FormControl('', Validators.compose([ | |
Validators.minLength(5), | |
Validators.required, | |
Validators.pattern('^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9]+$') //this is for the letters (both uppercase and lowercase) and numbers validation | |
])), | |
confirm_password: new FormControl('', Validators.required) | |
}, (formGroup: FormGroup) => { | |
return PasswordValidator.areEqual(formGroup); |
This file contains hidden or 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
validation_messages = { | |
'username': [ | |
{ type: 'required', message: 'Username is required.' }, | |
{ type: 'minlength', message: 'Username must be at least 5 characters long.' }, | |
{ type: 'maxlength', message: 'Username cannot be more than 25 characters long.' }, | |
{ type: 'pattern', message: 'Your username must contain only numbers and letters.' }, | |
{ type: 'validUsername', message: 'Your username has already been taken.' } | |
], | |
'name': [ | |
{ type: 'required', message: 'Name is required.' } |
This file contains hidden or 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-item> | |
<ion-label floating color="primary">Username</ion-label> | |
<ion-input type="text" formControlName="username" class="form-control"></ion-input> | |
</ion-item> | |
<div class="validation-errors"> | |
<ng-container *ngFor="let validation of validation_messages.username" > | |
<div class="error-message" *ngIf="validations_form.get('username').hasError(validation.type) && (validations_form.get('username').dirty || validations_form.get('username').touched)"> | |
{{ validation.message }} | |
</div> | |
</ng-container> |
This file contains hidden or 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
name: new FormControl('', Validators.required), | |
lastname: new FormControl('', Validators.required), | |
email: new FormControl('', Validators.compose([ | |
Validators.required, | |
Validators.pattern('^[a-zA-Z0-9_.+-][email protected][a-zA-Z0-9-]+.[a-zA-Z0-9-.]+$') | |
])), | |
terms: new FormControl(true, Validators.pattern('true')) |