ang2 notes
authorBill Erickson <berickxx@gmail.com>
Fri, 24 Nov 2017 19:10:27 +0000 (14:10 -0500)
committerBill Erickson <berickxx@gmail.com>
Fri, 24 Nov 2017 19:10:27 +0000 (14:10 -0500)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
NOTES.adoc

index 03ccea4..5f40a71 100644 (file)
@@ -28,6 +28,8 @@ sudo apt-get install -y nodejs
 * https://angular.io/tutorial
 ** Angular2+ is AngularJS in Greek.  Same concepts, new language.
 ** Modules, Services, Directives+Controllers=Components
+
+=== Typescript ===
 * TypeScript is not required, but is almost universally assumed in 
   Angular, RXJS, Mozilla docs, stackoverflow, you-name-it documentation.
 * NodeJS automates various developer tasks.  
@@ -52,7 +54,10 @@ ng build [--dev|--prod]
  ** New-style promises no longer have a 'notify' operation!
   ** https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
   ** Observables are the only way to have a stream.
+* Promises are good for representing a binary success/fail operation, while
+  Observabes are better suited to shuffling data, particularly streams of data.
 * RouteResolvers only want a single value from an observable.  Unclear why.
+* Observables not observered are not executed!!
 
 * Use 'declare' to tell TypeScript about global, legacy/non-exported 
   variables, e.g. opensrf libs.
@@ -62,7 +67,24 @@ ng build [--dev|--prod]
 declare var OpenSRF, OSRF_TRANSPORT_TYPE_WS;    
 ------------------------------------------------------------------------
 
-* i18n!
+* this
+
+[source,sh]
+------------------------------------------------------------------------
+foo => {this.bar} // 'this' refers to container class instance when present
+function foo() {this.bar} // 'this' refers to function
+------------------------------------------------------------------------
+
+* Consider local style guide recommendation for using camelCase for consistency.
+
+* c-sharp style get/set handler
+[source,sh]
+------------------------------------------------------------------------
+get foo(): String {return this.foo}
+set foo(str: String): void {this.foo = str}
+------------------------------------------------------------------------
+
+=== i18n! ===
  ** All text lives in templates -- could bypass TT2
  ** use XLIFF file by default
   *** Has context and notes information.
@@ -73,6 +95,7 @@ declare var OpenSRF, OSRF_TRANSPORT_TYPE_WS;
   *** Final build only contains french strings.
  ** can drop the egStrings module
 
+=== Services and Classes ===
 * Many services can just be classes
  ** Many egCore services don't need to be services, they're just
     coded that way because that's how AngJS allowed us to inject
@@ -81,6 +104,8 @@ declare var OpenSRF, OSRF_TRANSPORT_TYPE_WS;
     All we need is a class definition.
  ** Services used for sharing data and actions across modules,
     singleton objects, shuffling data, linking into ang lifecycle.
+* UPDATE: to some extent, this comes down to style/preference, but 
+using services seems to be the Ang2 way so likely the better approach.
 
 * Using JQUERY
 [source,sh]
@@ -127,6 +152,11 @@ import * as $ from 'jquery';
 </Directory>
 ------------------------------------------------------------------------
 
+=== angular-cli
+ * Compiling code bundles
+ * Minifying
+ * i18n translation file generation
+
 === Development w/ Apache
 
  * https://github.com/angular/angular-cli/wiki/stories-disk-serve
@@ -134,6 +164,17 @@ import * as $ from 'jquery';
    into .js, etc. files and recompile as the code is updated.  
  * Beware --deploy-url for setting base path for JS, etc. src's.
 
+
+== ng-bootstrap / Bootstrap 4
+* No more glyphicons
+* https://material.io/icons/
+
+== Upgrading...
+
+* Angular2 rewritten from scratch (in typescript)
+* Bootstrap4 is a "reboot"
+* ng-bootstrap rewritten from scratch
+
 == ng-upgrade, etc.
 
 * Start w/ an ang5 shell, integrate a simple angjs hello world