Skip to content

Instantly share code, notes, and snippets.

View adrianfaciu's full-sized avatar
🎯
Focusing

Adrian Fâciu adrianfaciu

🎯
Focusing
View GitHub Profile
@NgModule({
providers: [
{
provide: externalUrlProvider,
useValue: (route: ActivatedRouteSnapshot) => {
const externalUrl = route.paramMap.get('externalUrl');
window.open(externalUrl, '_self');
},
},
],
{
path: 'externalRedirect',
resolve: {
url: externalUrlProvider,
},
// We need a component here because we cannot define the route otherwise
component: NotFoundComponent,
},
const coreReducer = combineReducers(reducers, initialState);
const featureReducer = combineReducers(fromFeature.reducers, featureInitialState);
this.appState = {
...coreReducer(undefined, { type: 'INIT_STATE' }),
'featueModule': featureReducer(undefined, {type: 'INIT_STATE'}),
};
<div class="well">
<form class="form-horizontal"
[formGroup]="employeeDetailsForm"
novalidate
(ngSubmit)="addEmployee()">
<div class="form-group">
<label class="col-sm-2 control-label">Name</label>
<div class="col-sm-10">
<input type="text" id="name"
[formControl]="employeeDetailsForm.controls.name">
export class AppPreloadingStrategy implements PreloadingStrategy {
preload(route: Route, load: Function): Observable<any> {
const loadRoute = (delay) => delay
? timer(150).pipe(flatMap(_ => load()))
: load();
return route.data && route.data.preload
? loadRoute(route.data.delay)
: of(null);
}
}
export const routes: Routes = [
{ path: '', redirectTo: 'items', pathMatch: 'full' },
{
path: 'items',
loadChildren: 'app/+items/items.module#ItemsModule',
data: { preload: true, delay: false },
},
{
path: 'item',
loadChildren: 'app/+item-details/item-details.module#ItemDetailsModule',
export const routes: Routes = [
{ path: '', redirectTo: 'items', pathMatch: 'full' },
{
path: 'items',
loadChildren: 'app/+items/items.module#ItemsModule',
},
{
path: 'item',
loadChildren: 'app/+item-details/item-details.module#ItemDetailsModule',
},

Usefull list of commands for git:

  • git log master..development - show what commits are in development but not in master

A list of useful VS Code keyboard shortcuts that are usefull but I keep forgetting them:

  • Show function parameters tooltip => Ctrl+Shift+Space
  • Keep file opened => Ctrl + K Enter