docs: add two more examples

This commit is contained in:
Corbin Crutchley
2023-12-27 17:02:15 -07:00
parent 48205997d4
commit caede175fc
17 changed files with 26089 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
<html>
<head>
<title>Listen for Events</title>
</head>
<body>
<app-root></app-root>
</body>
</html>

View File

@@ -0,0 +1,28 @@
import "zone.js";
import { bootstrapApplication } from "@angular/platform-browser";
import { Component, Directive, ElementRef, inject } from "@angular/core";
const injectAndGetEl = () => {
const el = inject(ElementRef);
console.log(el.nativeElement);
return el;
};
@Directive({
selector: "[logEl]",
standalone: true,
})
class LogElDirective {
_el = injectAndGetEl();
}
@Component({
selector: "app-root",
standalone: true,
imports: [LogElDirective],
template: ` <p logEl>This paragraph tag will be logged!</p> `,
})
class AppComponent {}
bootstrapApplication(AppComponent);