Skip to content

Instantly share code, notes, and snippets.

@Grokling
Grokling / ui-router_decorate.js
Created September 11, 2015 01:31
Decorating ui-router resolves
app.config(function($stateProvider) {
// register a state decorator with ui-router. Decorate any property (I chose parent)
$stateProvider.decorator('parent', function (state, parentFn) { // read ui-router docs for decorator
// Get the resolves object for the state being registered
var resolves = state.self.resolve || {};
angular.forEach(resolves, function(resolve, key) { // for each resolve
// get the resolve function. Support array style [“$foo”, function($foo){ }]
var resolveFn = angular.isArray(resolve) ? resolve.slice(-1) : resolve;
@Grokling
Grokling / index.html
Last active November 18, 2015 05:51
flex-direction:column bug reproduction
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>flex-direction:column bug reproduction</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/angular-material/0.11.4/angular-material.css">
<style>
@Grokling
Grokling / rootReducer.js
Created June 30, 2016 11:24
Additions to jpsierens boilerplate for hot reloading of sagas and reducers
/**
* Combine all reducers in this file and export the combined reducers.
* If we were to do this in store.js, reducers wouldn't be hot reloadable.
*/
import { combineReducers } from 'redux';
import { LOCATION_CHANGE } from 'react-router-redux';
/*
* routeReducer