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
getAllErrors(form: FormGroup | FormArray): { [key: string]: any } | null { | |
// validation via form model | |
let hasError = false; | |
const result = Object.keys(form.controls).reduce((acc, key) => { | |
const control = form.get(key); | |
// console.log('control', control); | |
const errors = control instanceof FormGroup || control instanceof FormArray ? this.getAllErrors(control): control.errors; | |
if (errors || control.status === 'INVALID') { | |
acc[key] = errors; | |
hasError = true; |
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
#!/bin/bash | |
# Bash script to generate new angular modules | |
# Just go into the desired directory and type | |
# sh comp.sh nameOfModule | |
# Will create a directory and the module, controller, factory, and directive | |
mkdir $1 | |
cd $1 | |
cat <<EOF >> $1".module.js" |
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() { | |
//source: http://blog.guya.net/2015/06/12/sharing-sessionstorage-between-tabs-for-secure-multi-tab-authentication/ | |
if (!sessionStorage.length) { | |
// Ask other tabs for session storage | |
localStorage.setItem('getSessionStorage', Date.now()); | |
}; | |
window.addEventListener('storage', function(event) { |