Andrei Antal
BucharestJS Meetup
21.02.2018
...but difficult to use outside their context
A set of 4 standard specifications:
A set of 4 standard specifications:
<template>
<h1> Hello <h1>
<div>
...content
</div>
</template>
A set of 4 standard specifications:
<my-app>
<#shadow-root>
<div class="main">
<h1 class="title">
Hello
</h1>
...
<div>
</shadow-root>
</my-app>
A set of 4 standard specifications:
<html>
<head>
<link
rel="import"
href="file.html">
</link>
</head>
</html>
A set of 4 standard specifications:
<my-app>
<custom-header />
<main-content />
</my-app>
<body>
....
<my-datepicker date="02/02/2018"></my-datepicker>
...
</body>
Encapsulates
Exposes:
const myPicker = document.querySelector('my-dateicker');
elem.addEventListener('date-change', ev => { /* change */});
The good
The not so good
What is it?
import { Component, Prop, Event, Listen } from '@stencil/core';
@Component({
tag: 'my-component',
styleUrl: 'my-first-component.scss'
})
export class MyComponent {
@Prop() name: string;
@Event() someEvent: EventEmitter;
@Listen('someEvent')
eventHandler(event: CustomEvent) { ... }
render() {
return <p>
Hello {this.name}
</p>
}
}
<my-component name="World"></my-component>
A simple component
Angular Elements
SkateJS
Link to ngEurope 2018 talk: goo.gl/m2JdNU