• If you try to set it to a (single) driver that is unsupported it will fallback to the memory driver.
  • Expiry is also implemented for all drivers not just cookies
  • Types are available under Locker.DRIVERS or import {DRIVERS} from ‘angular-safeguard’
  • The library was renamed from angular2-locker to angular-safeguard
  • : angular-safeguard provides expiry on more than just cookies, to do this it’s necessary to create a bit of a more complex object so we can store expiry and more

angular library for managing session, locker and cookie storage, has backup for in-memory if none are supported
Continue reading “angular-safeguard”

Quicker Angular Forms Validation – I Write Code Sometimes

  • Then in the component with the Form that you want to add validation to, add the FormBuilder, and the FormGroup providers.
  • Never miss a story from I Write Code Sometimes , when you sign up for Medium.
  • So in light of this, I updated my Open Source Project, angular validators, to ng-validators.
  • npm install –save ng-validators
  • ng-validators is a wrapper around the widely known validator js library, and since I didn’t feel like rewriting validation that already existed out there, I did this.

The community is moving away from calling Angular by version names, Angular 2, Angular 4 and the likes. It’s now just Angular, mainly because of the clear 6 months release cycles recently mentioned…
Continue reading “Quicker Angular Forms Validation – I Write Code Sometimes”


  • import { Injectable } from ‘ @angular/core ‘ ; import { Action } from ‘ @ngrx/store ‘ ; import { ActionCreatorFactory } from ‘ ngrx-action-creator-factory ‘ ; @ Injectable () export class NowPlaylistActions { static MEDIA_ENDED = ‘ [NOW PLAYLIST] MEDIA_ENDED ‘ ; static QUEUE = ‘ [NOW PLAYLIST] QUEUE ‘ ; static SELECT = ‘ [NOW PLAYLIST] SELECT ‘ ; // as injectable constructor ( private acf : ActionCreatorFactory ) { this .
  • The factory allows to decalre a minimal action creator declaration with a typed payload for the action creator function and have type support when using this function.
  • Whenever a ts file is changed, it will rerun the tests.
  • npm install ngrx-action-creator-factory –save-dev
  • The service came out as a result of the open source project Echoes Player – an alternative player for watching and listening to media from youtube.

ngrx-action-creator-factory – An Action Creator Factory for ngrx
Continue reading “GitHub”


Ionic 2, markers only appear once  #angularjs #reactjs

  • Promise.all([ mapLoaded, locationsLoaded ]).then((result) => { this.locationCorodinates= result[1];//remove declaration for(let location of this.locationCorodinates){ this.maps.addMarker(location.latitude, location.longitude); }
  • locations:any[];//declare locations – Suraj Rao 5 hours ago
  • Set your location array as class variable and it should work.
  • You have set location array as local to the then function.
  • /providers/locations’; declare var google; /* Generated class for the AndaluciaMapa page.

The first time the page is executed, the markers are shown on the map.
But if I go back to another page and return to this page, the markers are not loading.
Continue reading “angular2”

angular/slice_pipe.ts at master · angular/angular · GitHub

  • * – **if negative**: return all items before `end` index from the end of the list or string.
  • * – **a negative integer**: return the item at `start` index from the end and all items after
  • * When operating on a blank value, the pipe returns the blank value.
  • * – `end`: The ending index of the subset to return.
  • * – **if positive and greater than the size of the expression**: return an empty list or string.

Contribute to angular development by creating an account on GitHub.
Continue reading “angular/slice_pipe.ts at master · angular/angular · GitHub”

The Amazing Angular 2 Router by Gerard Sans

  • /users.service’; @Component({ selector: ‘users’, template: `



    ` }) export class Users { constructor(private service:UsersService){ service.get().subscribe(users => this.users = users); } }

  • import { Component } from ‘@angular/core’; @Component({ selector: ‘users’, template: `



    ` }) export class Users { }

  • // { path: ‘users/:id’, component: User } Url: #/users/34;flag=true import { ActivatedRoute } from ‘@angular/router’; @Component({ selector: ‘user-details’ }) export class User implements OnInit { constructor(private route: ActivatedRoute){ route.params.subscribe(params => { let id =; // 34 }); } ngOnInit() { let id =; // 34 let flag = this.route.snapshot.params.flag; // true } }
  • // { path: ‘users/:id’, component: User } Url: #/users/34#section import { Router } from ‘@angular/router’; @Component({ selector: ‘user-details’ }) export class User implements OnInit { constructor(private router: Router){ router.routerState.root.fragment.subscribe(f => { let fragment = f; // section }); } ngOnInit() { let fragment = this.router.routerState.snapshot.root.fragment; // section } }
  • import { Injectable } from ‘@angular/core’; import { Http } from ‘@angular/http’; import ‘rxjs/add/operator/map’; import ‘rxjs/add/operator/retryWhen’; import ‘rxjs/add/operator/delay’; @Injectable() export class UsersService { constructor(private http:Http) { } get(){ return this.http.get(‘api/users.json’) .map(response => response.json()) .

Angular 2 comes with a new router. We will review its main features and show how we can use navigation guards, secure sections, use nested routes and do lazy load while quickly building a prototype for a very special client!
Continue reading “The Amazing Angular 2 Router by Gerard Sans”