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
angular.element(document.body).injector().get('$http') |
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 encodedDestHref = encodeURIComponent('https://example.com/#/hash/path?hparam1=a&hparam2=b'); | |
location.href = `https://example.com/path?dest=${encodedDestHref}`; | |
const searchParams = new URLSearchParams(location.search); | |
const destHref = searchParams.get('dest'); | |
const destUrl = new URL(destHref); | |
const hashRelativeUrl = new URL(destUrl.hash.substr(1), destUrl.origin); //hack | |
console.log(hashRelativeUrl.pathname); // '/hash/path' | |
console.log(hashRelativeUrl.search); // '?hparam1=a&hparam2=b' |
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
/* Anchors */ | |
a.clear-style { | |
color: inherit; | |
text-decoration: none; | |
} | |
/* Buttons */ | |
button.clear-style, | |
input[type=button].clear-style, | |
input[type=reset].clear-style { |
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
function logResult(result) { | |
console.log(result); | |
} | |
function logError(error) { | |
console.log('Looks like there was a problem: \n', error); | |
} | |
function validateResponse(response) { | |
if (!response.ok) { |
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
<!doctype html><html lang=en><meta charset=utf-8><title>Demo</title> | |
<link rel=stylesheet href=component.css> | |
<component></component> | |
<script src=https://ajax.googleapis.com/ajax/libs/angularjs/1.7.6/angular.min.js></script> | |
<script>angular.module('componentModule', [])</script> | |
<script src=component.js></script> | |
<script>angular.bootstrap(document.documentElement, ['componentModule'])</script> |
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 tagName = 'demo-app'; | |
const template = document.createElement('template'); | |
template.innerHTML = ` | |
<style> | |
:host { | |
display: block; | |
contain: content; | |
} | |
:host([hidden]) { |
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
Object.getPrototypeOf(customElements.get('my-custom-element')).name | |
// "HTMLElement" |
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
<!doctype html><html lang=en><meta charset=utf-8><title>Hello World!</title> |
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
/** Aborting $http made simple */ | |
export class AbortableHttpService { | |
constructor($q, $http, $timeout) { | |
this.$q = $q; | |
this.$timeout = $timeout; | |
this.$http = $http; | |
} | |
get(url, options = {}) { | |
const {$q, $http, $timeout} = this; |
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
fetch('/api/things') | |
.then(res => res.json()) | |
.then(res => console.log(res)) |