angular-lynx
AngularLynx Development
Build Angular apps that render natively on mobile via the Lynx runtime. Uses Angular's Renderer2 to map component templates to Lynx native elements (view, text, image, etc.) instead of browser DOM. Requires zoneless change detection — Zone.js is not available in Lynx.
Critical Rules
These prevent crashes and silent failures. Violating any will break your app on-device.
-
Bind Lynx event names. A tap is
(bindtap)(or(catchtap)to stop it bubbling).(click)also runs on a tap, which is what makes Angular'srouterLinkwork, and pointer events ((pointerdown),(pointermove)…) and the hover mouse events ((mouseenter),(mouseover)…) come from touches. DOM names Lynx also sends ((input),(focus),(blur),(scroll),(load),(error), touch, animation and transition events) listen asbinddoes, and(keyup.enter)runs on the return key; any other DOM event name, such as(mousedown)or(keydown), is silently ignored. Handlers can do anything they would on the web, navigation included: nosetTimeoutneeded. -
Put visible text inside
<text>. Lynx has no text nodes — only<text>elements display characters. Raw text straight in a<view>(or a<div>,<li>or component host) is drawn in an anonymous<text>, with the HTML inline tags beside it on one line, and inherits text styles through CSS variables the build adds. HTML text tags (<p>,<span>,<h1>,<a>,<button>,<label>…) render as<text>and inherit too. A<text>written as a Lynx element inherits nothing: set its text styles on it. -
scroll-viewrequires an explicit height. Withoutheight: 100vhor a flex constraint, scroll-view expands to fit content and never scrolls. -
Use
provideZonelessChangeDetection(). Zone.js crashes in the Lynx runtime. Zoneless change detection is mandatory. -
Import
LYNX_ELEMENTSin components. Without the element directives, Lynx elements silently fall through as unknown custom elements with no type-checking.