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
@NgModule({ | |
providers: [ | |
{ | |
provide: externalUrlProvider, | |
useValue: (route: ActivatedRouteSnapshot) => { | |
const externalUrl = route.paramMap.get('externalUrl'); | |
window.open(externalUrl, '_self'); | |
}, | |
}, | |
], |
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
const coreReducer = combineReducers(reducers, initialState); | |
const featureReducer = combineReducers(fromFeature.reducers, featureInitialState); | |
this.appState = { | |
...coreReducer(undefined, { type: 'INIT_STATE' }), | |
'featueModule': featureReducer(undefined, {type: 'INIT_STATE'}), | |
}; |
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
<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"> |
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
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); | |
} | |
} |
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
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', |
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
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