By: @BTroncone
Also check out my lesson @ngrx/store in 10 minutes on egghead.io!
Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!
Table of Contents
By: @BTroncone
Also check out my lesson @ngrx/store in 10 minutes on egghead.io!
Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!
Table of Contents
That's our RC:
$ cat ws-rc.yaml
apiVersion: v1
kind: ReplicationController
metadata:
name: webserver-rc
spec:
replicas: 5
selector:
npm install -g jspm@betajspm initjspm install angular2 reflect-metadata zone.js es6-shimThis will create a jspm_packages folder, and a config.js file.
Open the config.js file - this file manages options for the System.js loader - tweak it as appropriate
| // <script src="angular.min.js"></script> | |
| (function(name, factory) { | |
| // our basic IO module system that stores every module on modules with the "file" namespace | |
| // please use something like browserify rather than rolling your own like this | |
| window.modules = window.modules || {}; | |
| window.require = window.require || function require(name) { return window.modules[name] || window[name]; }; | |
| var exports = {}; factory(exports, window.require); | |
| window.modules[name] = exports; | |
| }('TodoService', function(exports, require) { |
| var elements = document.querySelectorAll("div"), | |
| callback = (el) => { console.log(el); }; | |
| // Spread operator | |
| [...elements].forEach(callback); | |
| // Array.from() | |
| Array.from(elements).forEach(callback); | |
| // for...of statement |
| [Unit] | |
| Description=Consul Discovery | |
| BindsTo=consul@%i.service | |
| After=consul@%i.service | |
| [Service] | |
| EnvironmentFile=/etc/environment | |
| ExecStart=/bin/sh -c "while true; do etcdctl mk /services/consul $COREOS_PUBLIC_IPV4 --ttl 60;/usr/bin/docker exec consul consul join $(etcdctl get /services/consul);sleep 45;done" | |
| ExecStop=/usr/bin/etcdctl rm /services/consul --with-value %H |
| #!/bin/bash | |
| # From https://gist.github.com/philips/56fa3f5dae9060fbd100 | |
| source /etc/environment | |
| name=$(cat /etc/machine-id) | |
| if [ ! -f /opt/consul ]; then | |
| mkdir /opt | |
| mkdir /var/lib/consul |
| #!/bin/bash | |
| source /etc/environment | |
| name=$(cat /etc/machine-id) | |
| if [ ! -f /opt/consul ]; then | |
| mkdir /opt | |
| mkdir /var/lib/consul | |
| curl http://storage.googleapis.com/ifup-org-tilde/consul-0.2.0-linux-x86-64.lzma | lzcat > /opt/consul | |
| chmod +x /opt/consul |
Press minus + shift + s and return to chop/fold long lines!
| app.directive('ngFocus', ['$parse', function($parse) { | |
| return function(scope, element, attr) { | |
| var fn = $parse(attr['ngFocus']); | |
| element.bind('focus', function(event) { | |
| scope.$apply(function() { | |
| fn(scope, {$event:event}); | |
| }); | |
| }); | |
| } | |
| }]); |