Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
What's new in Angular 2?
1. What’s new in Angular 2?
A COMPARISON BETWEEN NG1.X AND NG2
Alfred Jett Grandeza
Founder, Leangineer @ Lean Consulting
leanconsulting.ph | ajgrandeza.com
2. Lean Consulting
• Davao based start-up
• Founded: February 2016
• Lean Academy SOON!
• More info:
• leanconsulting.ph
• fb.com/leanconsutling.ph
3. About Me
•Graduate of Ateneo de Davao, Computer Science 2012
•Over 5 years of software engineering experience, .NET and AngularJS
•Former CTO of T.H.E. Patrons
•Co-founder of Lean Consulting/Lean Academy
•Microsoft Technology Associate (2)
•Member of Davao .NET Community (Davao .NET Users Group, Philippine .NET Users Group)
•I do consulting and freelance work from clients overseas
•Advocate of .NET Technologies
•I LOVE TO LEARN!
4. Prerequisites & Tools
• Required
• JavaScript
• HTML
• CSS
• Helpful
• OOP concepts
• Visual Studio Community
• https://www.visualstudio.com/
• Visual Studio Code
• https://code.visualstudio.com/
5. Single Page Application
• SPAs are web apps that load a single HTML page and dynamically that page as the user interacts
• Much of the work happen in the client side
• Usually written in JavaScript
7. Angular is…
• Open source, JavaScript based front-end framework
• Used for building client-side applications
• MVW Framework (Model-View-Whatever)
• Mainly maintained by Google
8. Why use Angular?
• Expressive/Customizable HTML
• Powerful Data Binding
• Modular
• Easy back-end integration
10. Key Features of Angular 1.X
• Directives
• Data binding
• Views
• Controllers
• $scope
• Modules
• Dependency Injection
• Routes
• Services
11. What is a directive?
• Extends HTML attributes, with the prefix “ng-”
• Teaches HTML new tricks
• There are built-in directives
• ng-app
• ng-view
• You can also create your own custom directives
13. Filters & Pipes
• Filters can be added to filter an array
•Pipes can be used to format a data
14. Views, Controllers, Scope
•View – UI / Display
•Controllers – Controls the logic, data and flow
•$scope is the “glue” between controller and view or the ViewModel
15. Modules & DI
• A container for the different parts of your Angular app
• You can package code as reusable modules
• You may inject different modules to your module
• Dependency Injection
• Instantiate a module
• ng-app=“”
• Creating a module
• angular.module(‘demoApp’, [])
20. Why Angular 2?
• Built for speed
• Modern
• Simplified API
• Enhanced Productivity
• Develop Across All Platforms
21. What is TypeScript?
• Open source programming language
• Developed and maintained by Microsoft
• A superset of JavaScript
• Transpiles to plain JavaScript
• Strongly typed
• Class based / OOP approach
• Learn more:
• http://www.typescriptlang.org/Playground
32. Pipes
• | lowercase
• | currency
• | uppercase
• No more filter
• You have to create your own pipe
33. Lifecycle Hooks
• A component has a lifecycle
• Angular offers component lifecycle hooks that give us ability to capture these moments
• In other words, events
• Samples
• OnInit
• OnChanges
• OnDestory
34. Services
• Services are independent from any components
• To provide shared data, logic across multiple components
• Encapsulate external interactions (i.e. Rest API)
38. What is RxJS?
• RxJS is a javascript library for composing asynchronous & event-based programs by using
observable sequences
• Used within Angular
• More info
• http://reactivex.io/rxjs/
39. Promises vs Observable
• Promise
• Returns a single value
• Not cancellable
• Observable
• Works with multiple values over time
• Cancellable
• “Retryable”
• Supports map, filter, reduce, etc..