Introduction to John Culviner GitHub: github.com/johnculviner Blog:johnculviner.com

Slides:



Advertisements
Similar presentations
What is jQuery Mobile? How to use it? Doncho Minkov Telerik Corporation Technical Trainer.
Advertisements

JavaScript and AJAX Jonathan Foss University of Warwick
John Culviner johnculviner.com DEMO CODE:
Developing HTML5 Application using MVVM pattern Pekka Ylenius.
Another look at Knockout JS By Peter Messenger Senior Developer – Triple Point Technology
Validation in Angular 1.3 And other angular tidbits.
Wireless: WDDPublic Follow along with the code: (or download the Join Me app.
Introduction to John johnculviner.com.
USING ANGULARJS WITH SITEFINITY
ICS 665 Jesse Abdul. jQuery UI Overview  jQuery UI javascript library Includes all UI component functionality  jQuery UI CSS framework Includes standard.
© 2006 by IBM 1 How to use Eclipse to Build Rich Internet Applications With PHP and AJAX Phil Berkland IBM Software Group Emerging.
Fundamentals, DOM, Events, AJAX, UI Doncho Minkov Telerik Corporation
Simon Amrein Consultant Trivadis AG What is ASP.NET 4.0 Ajax Ajax Control Toolkit Microsoft Ajax Content Delivery Network jQuery jQuery Client Templates.
What Are My Choices for Building a Modern Web UI?
Windows.Net Programming Series Preview. Course Schedule CourseDate Microsoft.Net Fundamentals 01/13/2014 Microsoft Windows/Web Fundamentals 01/20/2014.
Ori Calvo, 2010 “If people want to have maximum reach across *all* devices then HTML will provide the broadest reach” Scott Guthrie,
Introduction to John Culviner GitHub: github.com/johnculviner Blog:johnculviner.com
Single Page Applications with AngluarJS Bill Wolff Rob Keiser
NextGen Technology upgrade – Synerizip - Sandeep Kamble.
Pittsburgh Java User Group– Dec Java PureFaces: A JSF Framework Extension.
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQueryAngularJS AngularJS is a client-side JavaScript Framework for adding interactivity to HTML.
JavaScript & jQuery the missing manual Chapter 11
JavaScript Frameworks
Introduction Marko Marić, Danulabs
Philly.NET Hands-on Labs JAVASCRIPT SERIES. July 9: JavaScript Syntax Visual Studio ◦Projects ◦Editors ◦Debugging ◦Script blocks ◦Minification and bundling.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
JavaScript Framework for Rich Apps in Every Browser Maura Wilder Joan Wortman
Microsoft Virtual Academy Stacey Mulcahy | Technical Evangelist Christopher Harrison | Content Developer.
Fundamentals, Ajax, Templates, UI Doncho Minkov Telerik Corporation
Controllers and Markup Controllers, $scope, Markup, Directives, Expressions, Binding, Filters, Validation SoftUni Team Technical Trainers Software University.
INTEGRATION OF BACKBONE.JS WITH SPRING 3.1. Agenda New Features and Enhancements in Spring 3.1 What is Backbone.js and why I should use it Spring 3.1.
Introduction to Angular James Kahng. Terms Framework Template/environment constructed in the language where you fill in details with code Library Set.
Canopy walk through Single-Page Apps (SPAs) Benjamin Howarth Freelancer, Code Gecko Umbraco UK Festival, Fri 30 th Oct 2015 CODE GECKO.
Flux & React Web Application Development Mark Repka, Rich McNeary, Steve Mueller.
Learn AngularJS by Building 10 projects. Introduction to AngularJS An Open source web application framework by Google Written in JavaScript offers complete.
Getting Started with Angular 2 and TypeScript Nebraska.Code() 2016 Spencer Schneidenbach Ryvit.
Agenda 1)Modern web standards overview 2)JavaScript library overview 3)Building a Single Page Application SPA.
The New Face of ASP.NET ASP.NET MVC, Razor, and jQuery Ido Flatow | Senior Architect | Sela | This session is.
AngularJS. What is AngularJS  Javascript Framework  MVC  for Rich Web Application Development  by Google.
111 State Management Beginning ASP.NET in C# and VB Chapter 4 Pages
AngularJS and SharePoint
Chapter 5 Angularjs. Content Overview How to program with Angularjs Directives Expressions Controllers Filters HTML DOM Forms and Includes Ajax Scopes.
MVC 4.0, Knockout.js, Bootstrap and EF6.0 FAST, FLEXIBLE AND RESPONSIVE QUICK TO MARKET WEBSITES.
Angular JS and SharePoint
Web Technologies Computing Science Thompson Rivers University
The Share Widget Library
Angular 4 + TypeScript Getting Started
Extra Course
Angular JS Training | Angular JS online Training at GoLogica
Haritha Dasari Josue Balandrano Coronel -
CMPE 280 Web UI Design and Development November 7 Class Meeting
The Cliff Notes Version
Jessica Betts, Sophia Pandey, & Ryan Amundson
Training Institute Pune AngularJS Course. What is AngularJS ? AngularJS is a structural framework that is used in Single Page HTML for declaring dynamic.
Angularjs Interview Questions and Answers By Hope Tutors.
Top Reasons to Choose Angular. Angular is well known for developing robust and adaptable Single Page Applications (SPA). The Application structure is.
Displaying Form Validation Info
jQuery The Easy JavaScript Nikolay Chochev Technical Trainer
Introduction to AngularJS
Modern web applications
Rich single page applications with SharePoint
Modern web applications
Web Development Using ASP .NET
AngularJS Michael Kang August 20th 2015.
Angular 2 : CRUD Operations
Academic & More Group 4 谢知晖 王逸雄 郭嘉宋 程若愚.
Web Client Side Technologies Raneem Qaddoura
05 | An Introduction to AngularJS
Presentation transcript:

Introduction to John Culviner GitHub: github.com/johnculviner Blog:johnculviner.com

About Me Angular, JavaScript &.NET ILM Been developing on.NET professionally ~6 years Heavy JavaScript development ~4 years Manual, jQuery, Knockout.js, Durandal.js, Angular.js SPA development ~3 years Open Source Street Cred jQuery File Download FluentKnockoutHelpers AngularAgility A set of useful Angular.js extensions implementing common UX patterns to improve productivity

Overview What is Angular.js Why should I care about Angular.js? Angular.js features vs. other libraries Why I like Angular.js / Didn't like Angular.js Building a new social media site - FaceFolio $scope Directives Controllers Forms/Validation Ajax with $http/$resource Messaging with $scope.$emit/.$broadcast and.$on Building a simple directive Open Source AngularAgility project overview Objective: you leave today feeling like you can start using Angular.js right away

What is ? An MVC framework for efficiently creating dynamic views in a web browser (using “HTML” and JavaScript) Some highlights/focuses: Complete application framework From ‘jQuery replacement’ to a massive ‘enterprise’ SPA Fully dynamic MVVM with POJOs Low level-DOM manipulation/markup invention with directives and templates AJAX / REST API interaction Code organization, dependency injection, testability Comprehensive SPA and routing support

Why should I care? It's open source Actively developed by Google Google is paying devs to actively develop Angular Actively developed by open source community (on GitHub)

Angular.js #1? Angular.js appears to be winning the JavaScript framework battle (and for good reason) Lets see some evidence…

Why care? – Google trends As of 4/3/2014

Why care? – GitHub Stats AngularEmberBackboneKnockout Stars22,3519,78017,5384,821 Watches2, , Forks7,1442,1093, Commits past month Authors past month Major Releases past year As of 4/3/2014

Angular.js vs other libraries

vs jQuery is a library meant for is DOM manipulation, animations and an AJAX wrapper. NOT an application framework Pros None. Angular has built in ‘basic’ jQuery. If full-blown jQuery is added Angular will automatically use it. Generally full blown NOT needed. Cons Horrible choice for creating dynamic UIs. Verbose code, hard to maintain, not organized Not MVVM or MVC

vs Provides structure to web applications as well as model, view, templating, basic routing and RESTful interactions. Pros Older and more mature Cons “Previous generation” web app framework No MVVM w/o addons – use jQuery for DOM manip. No DI, not as easily testable Not a full-featured framework, meant to be ‘light’ Extremely verbose for what you get Not actively developed

vs A library that provides MVVM data bindings using observables and dependency tracking Pros Possibly more performant under some situations Not in my experience however Cons Complicated and error prone Dependency tracking, computeds get confusing “when complicated things break it's hard to figure out why” No POJO. Have to create “types” and ko.observable()s All it does is MVVM, not an app framework Testability, code organization etc. all potential issues

vs A full-fledged framework for web applications Pros Similar goals as Angular.js Cons Uses observables, special objects, string getters and setters, not dynamic Is ideal for LARGE web apps. Not intended for one off jQuery replacements Is arguably more complicated Very opinionated, have to use their object "bases" Not as popular as Angular

Why I like Angular best 1. FLEXIBLE! As big or small as you want it to be Two line jQuery replacement to a MASSIVE enterprise app 2. POJOs make life so easy. No ‘observables’, wrappers etc. Uses dirty checking for 2-way binding. Fully embraces the dynamic nature of JavaScript 3. The community and popularity 4. Super efficient 5. DI, services, factories, providers offer flexibility and familiarity to traditionally server side paradigms 6. Directives offer DSL-like extension to HTML for your domain specific use cases 7. Scopes, although tricky, offer extreme flexibility

Why I don't didn't like Angular Scopes are hard initially, but awesome Learning curve === eventual productivity

Live Coding time! A simple example Please Help!

Simple example ng-app attribute causes Angular to scan children for recognized tokens Creates the “root scope” $rootScope $rootScope ≈ a ViewModel Angular sees three “directives” {{firstName + " " + lastName}} Evaluated against the current $rootScope and updates the DOM on any change. "1 – way bound" ng-model="firstName" An input to be 2-way bound against $rootScope.firstName ng-model="lastName" An input to be 2-way bound against $rootScope.lastName

$rootScope = { firstName: “John”, lastName: “Culviner” }; Object fields and values are dynamically assigned by the bound directives. Directives Perform the 1 or 2 way binding between the DOM and the model ($rootScope) After typing: {{firstName + " " + lastName}} Watch for $scope changes and reevaluate the expression ng-model="firstName" Watch for $scope.firstName changes, update the textbox Watch for textbox changes, update $scope.firstName ng-model="lastName" Watch for $scope.lastName changes, update the textbox Watch for textbox changes, update $scope.lastName 1-way bound 2-way bound Original $rootScope: $rootScope = {};

What is Scope? Scope is an object that refers to the application model. It is an execution context for expressions. Scopes are arranged in hierarchical structure which mimic the DOM structure of the application. Scopes can watch expressions and propagate events. (from Angular website) Key points Scope is like a ViewModel that allows communication between JavaScript code and Views {{firstName + " " + lastName}} is an expr executed against scope Scope can be hierarchal with DOM nesting of directives Watches can be used to watch for changes to scope ex: $scope.$watch("firstName", function(value) { //update the DOM with the new value });

What is a Directive? A reusable component for performing DOM interaction, templating and possibly two-way binding against $scope The ONLY place JS to DOM interaction should occur Angular offers a huge amount of built in directives for common UI tasks, ex: someBool is true! 2 way binding inputs, setting classes, foreach loops of elements, clicking etc. You can write your own directives for domain specific purposes (a ‘DSL’ for HTML). Ex: …

What is a Directive? Or simply invoke an existing jQuery plugin Or if you need <=IE8 support: Wrappers for jQuery UI components (ex: datepicker) HUGE amount of directives out there due to Angular's popularity. Rarely have to write your own other than domain specific directives EX: AngularUI Twitter bootstrap wrappers Select2 Sorting Input masking Enhanced router Etc… AngularAgility (my open source project) A set of useful Angular.js extensions implementing common UX patterns to improve productivity

Adding "status updates" with a Controller

What is a Controller? A controller is really just a fancy name for a "scope container" that prototypically inherits from its parent scope container. A controller can interact with $scope (the 'view model') which the view can also interact with. $rootScope = { } Person Controller $scope = { firstName: "John", lastName: "Culviner", statuses: [{…}, {…}, …] }

Directives and Scope A controller is really a directive that is configured to prototypically inherit from its parent Directives can be configured for what type of scope they create and parent access they have Use "AngularJS Batarang" plugin for Chrome to explore scopes $rootScope = { } Person Controller $scope = { firstName: "John", lastName: "Culviner", statuses: [ { text: "foo", date: …}, { text: "bar", date: …} ] DIRECTIVE that prototypically inherits from $rootScope DIRECTIVE ng-model="firstName" / "lastName" Each use parent scope, no inheritance DIRECTIVE ng-repeat="status in statuses" Each record gets its own scope that prototypically inherits from Person Controller scope

Fixing the ugly dates and ordering with Filters

What is a Filter? A function that transforms an input to an output Reminds me a lot of LINQ extension method lambdas in.NET Can be "piped" UNIX style Can create own Angular has many built in filters: currency date filter json limitTo lowercase number orderBy uppercase

Validation with ng-form

What is ng-form? NOT a traditional HTML "form" Requires a "name" and "ng-model" on each input you wish to validate Angular will not push invalid values back into bound $scope Allows for validation of collections of controls Applies CSS classes to elements based on their validity Lots of built in validator directives that work with ng-form: required="" ng-minlength="{number}" ng-maxlength="{number}" ng-pattern="{string}" Angular UI has some extensions AngularAgility - FormExtensions makes it easier

Facefolio Progresses.... Lets check it out

Facefolio Progresses… A REST API around people and statuses has been created People GET '/people' – get all the people in the DB POST '/people' – save a new person POST '/people/:id' – save existing person with :id Statuses GET '/statuses' – get all statuses in the DB GET '/people/:id/statuses ' – get all statuses for person POST '/people/:id/statuses' – save person status DELETE '/people/:id/statuses/:statusId' – delete a particular status

Facefolio Progresses… File structure has been laid out more sensibly By functional area, NOT by type (like MVC) index.html – main layout with left navigation and top header /app /person person.html person.js /statusFeed statusFeed.html statusFeed.js app.js – app module definition, routing configuration index.js – controller code for index.html

Facefolio Progresses… Is now a Single Page App (SPA) with multiple "virtual pages" The hash changes but DOESN'T cause a full DOM refresh Data loaded in with AJAX and JSON Handled by AngularUI - Router

$resource for status CRUD

$scope.emit/.on for person name change

$scope.emit/.on $rootScope = { } Index Controller $scope = { people: [{},{},{}] } DIRECTIVE (RENDERING HTML!) ng-repeat="person in people" John Culviner Jane Doe, John Doe Person Controller $scope: { person: { firstName: "John", lastName: "Culviner } updatePerson: function() { //save a person } } Scopes can "message" parent/child scopes $scope.$emit(…) Message upward $scope.$broadcast(…) Message downward Here: When a person changes Notify the "Index" controller to refresh it's list (which has now changed) Hey someone changed! Refresh!

fieldLocker Directive

AngularAgility A set of useful Angular.js extensions implementing common UX patterns to improve productivity #1 Goal: Reduce/remove the maundane "every CRUD app I've made needs this stuff" code #2 Goal: Configurability

AngularAgility Form Extensions Generate Angular.js form fields, labels and rich validation messages with error notifications in one line of HTML A 'DSL' for Twitter Bootstrap (or whatever) because the markup is super verbose! Drastically reduce boilerplate HTML for form fields and validation messages Automatic form field validation message generation Form changed tracking, form resets, loading indicators, on-navigate away handling

ANGULAR AGILITY DEMO SITE

Questions/Comments? John Culviner GitHub: github.com/johnculviner Blog:johnculviner.com FACEFOLIO CODE HERE: ANGULAR AGILITY CODE HERE: