Computer
AngularJs
search
AngularJs
Precautions
Non-Medical
Not for Medical Care
The author uses several software packages and programming languages to develop FPnotebook content
For convenience, a dozen pages in FPNotebook are dedicated to quick notes on content creation
Technique
Angular 2 New Project
Use a starter project
Angular-2 CLI (command line interface)
https://github.com/angular/angular-cli
Angular quickstart
https://github.com/angular/quickstart
IDE Setup
See
VS Code
(includes TS tasks, snippets)
Further setup from the command prompt
Delete the .git directory if cloned from quickstart or similar
Git init, git add -A (or .), and git commit -m (as well as git push to a repository)
Npm install
Typescript will be compiled when
Running
the launch task in
VS Code
Alternatively "Tsc" to compile the typescript files
Technique
Debugging in Chrome
Add the Augury plug-in (previously Batarang)
Allows visualization and navigation of angular components within Google Chrome
Chrome developer tools
Find the id of the object of interest in the UI Elements window (e.g. $0)
Typing the identifier (e.g. $0) in the console window will return the object and allow for drilling down
Modify the contents of the object using ng.probe($0).componentInstance.PROPERTY = NEW_VALUE
Changes will take effect with ng.probe($0)._debugInfo._view.changeDetectorRef.detectChanges()
Other debugging tools
debugger;
Place within code, and a break will occur at this point
If tsconfig.json is set to use "sourceMap: true", then debugger will display the source typescript code
Json pipe: {{item | json}}
Outputs the model item to the UI in readable json format
Logging
Consider npm installing the angular2-logger
References
https://www.pluralsight.com/guides/debugging-angular-2-applications
Technique
Angular-Bootstrap (old for angular 1)
Website
https://angular-ui.github.io/bootstrap/
Preparation
Use Angular 1.2.x versions (as of 4/26/2015)
Angular-Bootstrap is the Bower package to install
Add the ui-bootstrap-tpls.min.js file to the index.html
Follow instructions for CSS modifications
Follow instructions for adding "ui.bootstrap" to the angular module dependencies
Restoring bootstrap.js functionality
Navbar button functionality (collapsed and menu dropdowns)
http://stackoverflow.com/questions/14741988/twitter-boostrap-navbar-with-angular-js-collapse-not-functioning#23918553
Toggle button changes
Remove data-toggle and data-target from the toggle button
Add ng-init="isCollapsed" and ng-click="isCollapsed=!isCollapsed" to the toggle button
Change the collapsed div to ng-class={collapse: isCollapsed}
Dropdown buttons
Add ng-class={open:ddBtn} ng-init="ddBtn=false" ng-click="ddBtn=!ddBtn"
Type your search phrase here