Skip to content

Instantly share code, notes, and snippets.

Aleksandar Milošević sasxa

Block or report user

Report or block sasxa

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View loader.directive.ts
import {
ComponentFactoryResolver,
Directive,
Input,
OnInit,
Output,
ViewContainerRef,
ComponentRef,
EventEmitter
} from '@angular/core';
@sasxa
sasxa / app-routing.module.ts
Created Oct 16, 2016
Nested lazy loaded routes
View app-routing.module.ts
export const routes: Routes = [
{
path: '',
component: AppComponent,
children: [
{ path: 'home', component: DummyComponent },
{ path: '', canLoad: [AuthGuard], loadChildren: './viewer/viewer.module#ViewerModule' },
// { path: '_', canLoad: [AuthGuard], loadChildren: './editor/editor.module#EditorModule' },
{ path: '**', redirectTo: 'home' },
@sasxa
sasxa / BaseForm.ts
Last active May 23, 2017
Angular2 Forms with @ngrx/store
View BaseForm.ts
export class _BaseForm {
_builder: FormBuilder;
_group: ControlGroup;
public controls = (value: any = {}) => ({
});
public selector: string = "examples";
public store: Store<any>;
constructor() { }
@sasxa
sasxa / BaseRoute.ts
Last active Jul 25, 2018
Angular2 Redirection using @ngrx/store
View BaseRoute.ts
export class _BaseRoute {
public store: Store<any> = getSingleton(Store);
public title: string;
constructor() { }
routerOnActivate(next: ComponentInstruction, prev: ComponentInstruction) {
this.store.dispatch({ type: "UPDATE_ROUTE", payload: { next, prev } });
this.store.dispatch({ type: "UPDATE_UI", payload: { title: this.title } });
}
@sasxa
sasxa / queue.yaml
Last active Oct 21, 2016
Google Cloud Endpoints Authentication (Google App Engine, Python) - getting user profile from Google+
View queue.yaml
total_storage_limit: 200M
queue:
- name: registration
rate: 20/s
bucket_size: 40
max_concurrent_requests: 10
retry_parameters:
task_age_limit: 10h
min_backoff_seconds: 10
@sasxa
sasxa / karma.conf.js
Last active Jul 14, 2016
Setup for karma testing
View karma.conf.js
// Karma configuration
// Generated on Thu Dec 24 2015 20:24:55 GMT+0100 (Central Europe Standard Time)
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
@sasxa
sasxa / emitter.service.ts
Created Jan 2, 2016
Angular2 Communicating between sibling components
View emitter.service.ts
import {Injectable, EventEmitter} from 'angular2/core';
@Injectable()
export class EmitterService {
private static _emitters: { [ID: string]: EventEmitter<any> } = {};
static get(ID: string): EventEmitter<any> {
if (!this._emitters[ID])
this._emitters[ID] = new EventEmitter();
return this._emitters[ID];
You can’t perform that action at this time.