Skip to content

Instantly share code, notes, and snippets.

View NishuGoel's full-sized avatar

Nishu Goel NishuGoel

View GitHub Profile
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule
],
providers: [DataService],
bootstrap: [AppComponent]
})
const el = document.createElement('app-instruction-card');
const cmp = new AppInstructionCardCmp();
renderComponent(el, cmp);
if(ctx.val !== oldValue) {
cmp.value = ctx.val;
oldValue = cmp.value;
ng.updateView(el, cmp);
}
import '@nishugoel/my-web-comp/my-web-comp.js';
class NewCustElement extends LitElement{
render(){
return html`
<my-web-comp></my-web-comp> // Using our custom element inside the implementation of another custom element
`;
}
}
customElements.define('new-cust-ele', NewCustElement);
<html>
<head>
<script type="module" src="node_modules/package-name/my-web-comp.js"></script>
</head>
<body>
<my-web-comp></my-web-comp>
</body>
<html>
<html>
<head>
<script type="module" src="/path/to/my-web-comp.js"></script>
</head>
<body>
<my-web-comp></my-web-comp>
</body>
</html>
@customElement('my-web-comp')
export class myWebComp extends LitElement {
@property()
compProp = 'hello';
render(){
return html`<p>${this.compProp}</p>`;
}
export class myWebComp extends LitElement {
render() {
return html `<div>text here</div>`
}
}
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean | UrlTree {
const url = 'dest';
const tree: UrlTree = this.router.parseUrl(url);
return tree;
}
export type RunGuardsAndResolvers = 'pathParamsChange' | 'paramsChange' | 'paramsOrQueryParamsChange' | 'always';
Object.keys(containee).every(key => containee[key] === container[key]);
//changed to
Object.keys(containee).every(key => equalArraysOrString(container[key], containee[key]));