This is a proposal for a lightning talk at Reactive Conf. Please 🌟 this gist to push the proposal! If you're on your phone, please request the 🖥 desktop site to star this gist 😇 #ReactiveConf
This file contains 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
import { Injectable } from '@angular/core'; | |
import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Router } from '@angular/router'; | |
import { Observable } from 'rxjs/Observable'; | |
import { AngularFire } from 'angularfire2'; | |
import 'rxjs/add/operator/map'; | |
@Injectable() | |
export class AuthGuard implements CanActivate { | |
constructor(private af: AngularFire, private router:Router) {} |
This file contains 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
0 info it worked if it ends with ok | |
1 verbose cli [ '/usr/local/Cellar/node/8.1.0_1/bin/node', | |
1 verbose cli '/usr/local/bin/npm', | |
1 verbose cli 'uninstall', | |
1 verbose cli '-g', | |
1 verbose cli '@angular/cli' ] | |
2 info using [email protected] | |
3 info using [email protected] | |
4 verbose npm-session fe4975a670f046da | |
5 silly install loadCurrentTree |
This file contains 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
render() { | |
return <div class="image-upload"> | |
<div class="image-upload__edit"> | |
<label htmlFor="file"></label> | |
<input type="file" name="files[]" id="file" accept="image/*" class="image-upload__input" | |
onChange={($event: any) => this.onInputChange($event.target.files)} /> | |
</div> | |
<div class="image-upload__preview"> | |
<div id="image-preview"></div> |
This file contains 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
.image-upload { | |
position: relative; | |
max-width: 205px; | |
margin: 50px auto; | |
} | |
.image-upload__edit { | |
position: absolute; | |
top: 10px; | |
right: 12px; |
This file contains 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
import { Component} from '@stencil/core'; | |
@Component({ | |
tag: 'my-component', | |
styleUrl: 'my-component.css', | |
shadow: true | |
}) | |
export class MyComponent { | |
public onInputChange(files: FileList) { | |
// check if 1 image is uploaded |
This file contains 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
import { Component } from '@stencil/core'; | |
const MAX_UPLOAD_SIZE = 1024; // bytes | |
const ALLOWED_FILE_TYPES = 'image.*'; | |
@Component({ | |
tag: 'my-component', | |
styleUrl: 'my-component.css', | |
shadow: true | |
}) |
This file contains 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
import { Component } from '@stencil/core'; | |
const MAX_UPLOAD_SIZE = 1024; // bytes | |
const ALLOWED_FILE_TYPES = 'image.*'; | |
@Component({ | |
tag: 'my-component', | |
styleUrl: 'my-component.css', | |
shadow: true | |
}) |
This file contains 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
import { Component, Element } from '@stencil/core'; | |
const MAX_UPLOAD_SIZE = 1024; // bytes | |
const ALLOWED_FILE_TYPES = 'image.*'; | |
@Component({ | |
tag: 'my-component', | |
styleUrl: 'my-component.css', | |
shadow: true | |
}) |
This file contains 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
import { Component, Element, Event, EventEmitter } from '@stencil/core'; | |
const MAX_UPLOAD_SIZE = 1024; // bytes | |
const ALLOWED_FILE_TYPES = 'image.*'; | |
@Component({ | |
tag: 'my-component', | |
styleUrl: 'my-component.css', | |
shadow: true | |
}) |
OlderNewer