ang2 notes WIP
authorBill Erickson <berickxx@gmail.com>
Thu, 16 Nov 2017 17:06:49 +0000 (12:06 -0500)
committerBill Erickson <berickxx@gmail.com>
Thu, 16 Nov 2017 17:06:49 +0000 (12:06 -0500)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
NOTES.adoc [new file with mode: 0644]

diff --git a/NOTES.adoc b/NOTES.adoc
new file mode 100644 (file)
index 0000000..1203e61
--- /dev/null
@@ -0,0 +1,76 @@
+= AngularJS -> Angular2+ Upgrade Notes ==
+
+== State of AngularJS =
+
+AngularJS future is uncertain, but it won't disappear tomorrow:
+
+https://stackoverflow.com/questions/37037251/angularjs-1-x-support-lifecycle/37037365
+
+We have a little breathing room.
+
+[quote]
+--------------------------------------------------------
+Although my opinion isn't official, I would expect that the community of 
+developers will fork Angular 1.x and continue to maintain it for many 
+years. There are far too many large applications written on top of 
+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).
+[source,sh]
+--------------------------------------------------------
+curl -sL https://deb.nodesource.com/setup_8.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.
+* TypeScript is not required, but is almost universally assumed in 
+  Angular, RXJS, Mozilla docs, stackoverflow, you-name-it documentation.
+* NodeJS automates various developer tasks.  
+ ** Handles boilerplate code generation.
+ ** TypeScript AOT (ahead-of-time) compiler
+ ** NodeJS is not required for serving files in real time.
+ ** Some dependencies we manually manage (grunt-uglify, karma, etc.) are
+    baked into 'ng build'
+ ** TypeScript and other dependency mangling can be precompiled to JS for 
+    deployment to use with Apache, etc.
+[source,sh]
+--------------------------------------------------------
+# --prod includes uglify, etc.
+ng build [--dev|--prod]
+--------------------------------------------------------
+* Observables are more common than Promise's (same idea, different terms).
+ ** http://reactivex.io/rxjs/
+ ** http://reactivex.io/rxjs/class/es6/Observable.js~Observable.html
+ ** These have a slight benefit over promises of a consistent caller API 
+    for atomic and streaming calls.  
+ ** 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.
+* RouteResolvers only want a single value from an observable.  Unclear why.
+
+* 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 
+ ** 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.
+
+
+== ng-upgrade , etc.
+
+* Start with an angularjs hello-world and upgrade it.
+* Try an angular2 hello-world and downgrade it.
+
+