From: Bill Erickson Date: Wed, 26 Sep 2018 16:30:01 +0000 (-0400) Subject: ang6 notes continued X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=e22253c0aac02e3d40ddf37000e0ee4053d7e9d4;p=working%2Frandom.git ang6 notes continued Signed-off-by: Bill Erickson --- diff --git a/ang6-toturial.adoc b/ang6-toturial.adoc index 930e363a8..4ea7291ea 100644 --- a/ang6-toturial.adoc +++ b/ang6-toturial.adoc @@ -39,6 +39,10 @@ Modules serve 2 main functions: == Component Declaration Hierarchy == +Easy mistake to make! +Especially with lazy-loaded components. You don't know it's a +problem until you've loaded the conflicting component. + Module Foo declares Component SomeCompent. Module Bar wants to use Component SomeCompent. Module Bar cannot also declare SomeComponent. @@ -94,4 +98,52 @@ myComp.foo.subscribe(b => myBool=b); @ViewChild('')... +Ref is set to null if the child component is destroyed + +== keyboard actions == + +(keyup.enter)="submit()" + +== observables == + +value of .pipe(tap(...)) + +== Groking route data == + +The route API is complex, but expressive. + +REVISIT WITH SIMPLER EAMPLE TODO +Simple example: + +Execution context /eg2/staff/admin/server/config +constructor(private route: ActivatedRoute) {} + +this.route.snapshot.parent.url[0].path === 'config' + +== lifecycle hooks + +ngOnInit used frequently +https://angular.io/guide/lifecycle-hooks + + +== GOTCHAS +=== Error handling + +* fatal errors (route-preventing) returns to base app page. + +=== Methods vs. Functions + +(click)="doStuff()" => this.doStuff() => this == component instance +[handleClick]="doStuff" => doStuff() => this == the HTML element + +== compiling + +* diffs between dev and prod (jit/aot) + +compile regularly with --prod to verify +and ng lint + +in --watch mode kill and restart after any major changes +(moving modules around, adding new components, etc.) +