Skip to content

Instantly share code, notes, and snippets.

View etiennetalbot's full-sized avatar

Etienne Talbot etiennetalbot

  • Poka
  • Québec City, Canada
View GitHub Profile
@etiennetalbot
etiennetalbot / app.component.ts
Last active December 13, 2018 16:04
Angular Resolver - NavigationStart and NavigationEnd
import { Component, OnInit } from '@angular/core';
import { filter } from 'rxjs/operators';
import { NavigationEnd, NavigationStart, Router } from '@angular/router';
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
})
export class AppComponent implements OnInit {
isLoadingRoute: boolean = false;
@etiennetalbot
etiennetalbot / pilots-list.component.ts
Last active December 13, 2018 16:05
Angular Resolver - Get data from resolver
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
@Component({
selector: 'pilots-list',
templateUrl: 'pilots-list.component.html',
})
export class PilotsListComponent implements OnInit {
pilotsList: [];
@etiennetalbot
etiennetalbot / pilot-routing.module.ts
Last active December 13, 2018 13:24
Angular Resolver - Routing module example
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { HashLocationStrategy, LocationStrategy } from '@angular/common';
import { PilotsListComponent } from './components/pilots-list/pilots-list.component';
import { PilotsListResolver } from './resolvers/pilots-list.resolver';
const pilotRoutes: Routes = [
{
component: PilotsListComponent,
@etiennetalbot
etiennetalbot / pilots-list.resolver.ts
Last active December 13, 2018 16:09
Resolver example
import { Injectable } from '@angular/core';
import { Resolve } from '@angular/router';
import { PilotService } from '../services/pilot.service';
import { Observable } from 'rxjs';
@Injectable()
export class PilotsListResolver implements Resolve<Observable<any>> {
constructor(private pilotService: PilotService) {}
resolve(): Observable<any> {
@etiennetalbot
etiennetalbot / App.Module.js
Last active August 31, 2016 06:34
Javascript Module
/*jslint nomen: true */
window.App = window.App || {};
window.App.ModuleName = (function (document, $) {
'use strict'; //OPTIONAL if you don't want your code to be strict
var _vars, _els, _privateMethod, init;
@etiennetalbot
etiennetalbot / coffee-capsule.coffee
Last active December 17, 2015 12:19
A capsule to put your CoffeeScript into.Basic OOP CoffeeScript file
window.App = window.App or {}
window.App.Module = do (document = document, window = window, $ = jQuery) ->
# Module's common variables (private)
_vars =
yThreshold: 0
windowHeight: 0
videoPlaying: null
videoToPlay: null
# Module's common elements (private)