ang2 notes
authorBill Erickson <berickxx@gmail.com>
Fri, 17 Nov 2017 15:36:33 +0000 (10:36 -0500)
committerBill Erickson <berickxx@gmail.com>
Fri, 17 Nov 2017 15:36:33 +0000 (10:36 -0500)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
NOTES.adoc

index 1203e61..3c97767 100644 (file)
@@ -18,15 +18,16 @@ Angular 1.x to just drop everything and dash off to Angular2.
 
 == Writing a new app the Angular2 way to experiment ==
 
-* Install NodeJS v8 (v6 should also work).
+* Install NodeJS v6
 [source,sh]
 --------------------------------------------------------
-curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
+curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
 sudo apt-get install -y nodejs
 --------------------------------------------------------
  ** See also https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions[NodeJS Install Docs]
 * https://angular.io/tutorial
-** Angular2+ is just AngularJS in Greek.  Same concepts, new language.
+** Angular2+ is AngularJS in Greek.  Same concepts, new language.
+** Modules, Services, Directives+Controllers=Components
 * TypeScript is not required, but is almost universally assumed in 
   Angular, RXJS, Mozilla docs, stackoverflow, you-name-it documentation.
 * NodeJS automates various developer tasks.  
@@ -56,21 +57,51 @@ ng build [--dev|--prod]
 * Use 'declare' to tell TypeScript about global, legacy/non-exported 
   variables, e.g. opensrf libs.
 [source,sh]
---------------------------------------------------------
+------------------------------------------------------------------------
 // Global vars from opensrf.js                                                 
 declare var OpenSRF, OSRF_TRANSPORT_TYPE_WS;    
---------------------------------------------------------
+------------------------------------------------------------------------
 
 * i18n!
- ** use XLIFF file 
+ ** All text lives in templates -- could bypass TT2
+ ** use XLIFF file by default
+  *** Has context and notes information.
+  *** Not supported by launchpad.
+  *** cursory glance suggests .po files aren't supported
  ** Pre-compile language-specific builds for speedy fun-times
   *** ng build --aot --i18nFile=src/locale/messages.fr.xlf --i18nFormat=xlf --locale=fr
   *** Final build only contains french strings.
+ ** can drop the egStrings module
+
+* 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
+    shared code into each module.
+ ** E.g. we don't need an injectable shared service for egEvent.
+    All we need is a class definition.
+ ** Services used for sharing data and actions across modules,
+    singleton objects, shuffling data, linking into ang lifecycle.
+
+* Using JQUERY
+[source,sh]
+------------------------------------------------------------------------
+npm install --save jquery
+npm install -D @types/jquery
+# In the code:
+import * as $ from 'jquery';                                                   
+------------------------------------------------------------------------
 
+=== Development w/ Apache
 
-== ng-upgrade , etc.
+ * https://github.com/angular/angular-cli/wiki/stories-disk-serve
+ * Basically, use 'ng build --watch' -- it will compile the build
+   into .js, etc. files and recompile as the code is updated.  
+ * Beware --deploy-url for setting base path for JS, etc. src's.
 
-* Start with an angularjs hello-world and upgrade it.
-* Try an angular2 hello-world and downgrade it.
+== ng-upgrade, etc.
 
+* Start w/ an ang5 shell, integrate a simple angjs hello world 
+directive.
+* Add an ang5 service and use from the angjs directive.
+* Add an angjs service and use from ang5 component.