AngularJS. What is AngularJS  Javascript Framework  MVC  for Rich Web Application Development  by Google.

Slides:



Advertisements
Similar presentations
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
Advertisements

Lesson 12- Unit L Programming Web Pages with JavaScript.
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.
Javascript and AJAX Willem Visser RW334. Overview Javascript jQuery AngularJS AJAX.
@lestersconyers #spsevents #spsphx SPS EVENTS PHX SharePoint and Angular Sitting in a Tree… LESTER SCONYERS.
Development of mobile applications using PhoneGap and HTML 5
XML on the Web: is it still relevant? O'Neil D. Delpratt.
Forms, Validation Week 7 INFM 603. Announcements Try placing today’s example in htdocs (XAMPP). This will allow you to execute examples that rely on PHP.
Introduction to John Culviner GitHub: github.com/johnculviner Blog:johnculviner.com
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.
JSP Standard Tag Library
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.
Introduction Marko Marić, Danulabs
AngularJS Routing Routes, Route Parameters, Templates, Location, Navigation SoftUni Team Technical Trainers Software University
Bob German Principal Architect A New on SharePoint Development Building Light-Weight Web Parts with AngularJS
AngularJS Services Built-in and Custom Services SoftUni Team Technical Trainers Software University
JDeveloper 10g and JavaServer Faces: High-Performance UIs on the Web Avrom Roy-Faderman Senior Programmer May, 2006.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
Copyright 2007 Adobe Systems Incorporated. 1 ColdFusion 8 : Advanced AJAX Development Rakshith N Computer Scientist Jan 02, 2008.
Developer TECH REFRESH 15 Junho 2015 #pttechrefres h Web Going Foward.
Introduction to Angular JS Sergey Barskiy Working Class Nobody Level: Introductory.
Microsoft Virtual Academy Stacey Mulcahy | Technical Evangelist Christopher Harrison | Content Developer.
ANGULARJS A Gentle Introduction John /
Controllers and Markup Controllers, $scope, Markup, Directives, Expressions, Binding, Filters, Validation SoftUni Team Technical Trainers Software University.
Introduction to Angular James Kahng. Terms Framework Template/environment constructed in the language where you fill in details with code Library Set.
JAVA BEANS JSP - Standard Tag Library (JSTL) JAVA Enterprise Edition.
Angular Gotchas Best of Web…but watch out Responsive application build with HTML5 and Javascript Mike R. Emo Founder iEmoSoft consulting Featuring Nick.
ANGULARJS A Gentle Introduction John Madison.NET User Group.
AJAX and REST. Slide 2 What is AJAX? It’s an acronym for Asynchronous JavaScript and XML Although requests need not be asynchronous It’s not really a.
Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.
Chapter 1 Ionic Framework (overview) Front-end framework for developing hybrid mobile apps with HTML5 Yeunyong Kantanet School of Information and Communication.
Flux & React Web Application Development Mark Repka, Rich McNeary, Steve Mueller.
1 Objects In JavaScript. 2 Types of Object in JavaScript Built-in objects User Defined Objects Browser Object Document Object Model.
Learn AngularJS by Building 10 projects. Introduction to AngularJS An Open source web application framework by Google Written in JavaScript offers complete.
AngularJS and SharePoint
AngularJS Best Practices High Quality SPA Applications SoftUni Team Technical Trainers Software University
ANGULAR 2. JavaScript is a high-level, dynamic, untyped, and interpreted programming language. JavaScript was originally developed in May 1995 by Brendan.
© Luxoft Training. All rights reserved AngularJS Introduction.
Chapter 5 Angularjs. Content Overview How to program with Angularjs Directives Expressions Controllers Filters HTML DOM Forms and Includes Ajax Scopes.
Angular JS and SharePoint
Unit M Programming Web Pages with
Unit M Programming Web Pages with
Web Software Model CS 4640 Programming Languages for Web Applications
AngularJS A Gentle Introduction John
Angular JS Training | Angular JS online Training at GoLogica
CMPE 280 Web UI Design and Development November 7 Class Meeting
The Cliff Notes Version
Jessica Betts, Sophia Pandey, & Ryan Amundson
Top Reasons to Choose Angular. Angular is well known for developing robust and adaptable Single Page Applications (SPA). The Application structure is.
Angular (JS): A Framework for Dynamic Web Pages
Introduction to AngularJS
Modern web applications
Modern web applications
Secure Web Programming
AngularJS Michael Kang August 20th 2015.
…and web frameworks in general
Chengyu Sun California State University, Los Angeles
Back end Development CS Programming Languages for Web Applications
Chengyu Sun California State University, Los Angeles
PART 1.
Web Technologies Computing Science Thompson Rivers University
05 | An Introduction to AngularJS
Back end Development CS Programming Languages for Web Applications
CMPE 280 Web UI Design and Development November 8 Class Meeting
Presentation transcript:

AngularJS

What is AngularJS  Javascript Framework  MVC  for Rich Web Application Development  by Google

Why AngularJS “Other frameworks deal with HTML’s shortcomings by either abstracting away HTML, CSS, and/or JavaScript or by providing an imperative way for manipulating the DOM. Neither of these address the root problem that HTML was not designed for dynamic views”. ●Lightweight ( < 36KB compressed and minified) ●Free ●Separation of concern ●Modularity ●Extensibility & Maintainability ●Reusable Components

●Allows for DOM (Document Object Model) Manipulation ●Does not provide structure to your code ●Does not allow for two way binding What we used previously.

PHP vs. Angular JS

ConceptDescription TemplateHTML with additional markup Directivesextend HTML with custom attributes and elements Modelthe data shown to the user in the view and with which the user interacts Scopecontext where the model is stored so that controllers, directives and expressions can access it Expressionsaccess variables and functions from the scope Filterformats the value of an expression for display to the user Viewwhat the user sees (the DOM) Data Bindingsync data between the model and the view Controllerthe business logic behind views Servicereusable business logic independent of views

Select value: {{ theValue }} 1 2 Select value: 1 2 $(function() { $('#theSelect').on('change', function() { var value = $(this).val(); $('#theValue').text(value); } });

AngularJS Extends HTML The ng-app directive defines an AngularJS application. The ng-model directive binds the value of HTML controls (input, select, textarea) to application data. The ng-bind directive binds application data to the HTML view.

Some Features  Two-way Data Binding – Model as single source of truth  Directives – Extend HTML  MVC - Model View Controller  Dependency Injection  Testing  Deep Linking (Map URL to route Definition)  Server-Side Communication

Simple Example Hi {{user.name}}

MVC Model (Data) Controller (Logic) View (UI) Change Notifies Event Notification Changes

MVC - Model View Controller Controller Model View JS Classes DOM JS Objects

Bootstrapping

Expressions AngularJS binds data to HTML using Expressions. My first expression: {{ }} The third item is

Directives AngularJS lets you extend HTML with new attributes called Directives. Name:

Directives <div ng-app="" ng-init="names=[ {name:'Jani',country:'Norway'}, {name:'Hege',country:'Sweden'}, {name:'Kai',country:'Denmark'}]"> {{ x.name + ', ' + x.country }}

Controllers AngularJS controllers control the data of AngularJS applications. First Name: Last Name: Full Name: {{fullName()}} var app = angular.module('myApp', []); app.controller('personCtrl', function($scope) { $scope.firstName = "John"; $scope.lastName = "Doe"; $scope.fullName = function() { return $scope.firstName + " " + $scope.lastName; } });

Filters Filter Description currencyFormat a number to a currency format. filter Select a subset of items from an array. lowercaseFormat a string to lower case. orderByOrders an array by an expression. uppercaseFormat a string to upper case. Filter is used to do some transformation of the scoped Data. Filter is applied using the symbol | (pipe). Total = {{ (quantity * price) | currency }}

Server Interaction $http is an AngularJS service for reading data from remote servers. { "records": [ { "Name" : "Alfreds Futterkiste", "City" : "Berlin", "Country" : "Germany" }, { "Name" : "Berglunds snabbköp", "City" : "Luleå", "Country" : "Sweden" }, { "Name" : "Centro comercial Moctezuma", "City" : "México D.F.", "Country" : "Mexico" } ]}

Server Interaction $http is an AngularJS service for reading data from remote servers. {{ x.Name + ', ' + x.Country }} var app = angular.module('myApp', []); app.controller('customersCtrl', function($scope, $http) { $http.get(" {$scope.names = response.records;}); });

Modules A module is a container for the different parts of an application. All application controllers should belong to a module. {{ firstName + " " + lastName }} var app = angular.module("myApp", []); app.controller("myCtrl", function($scope) { $scope.firstName = "John"; $scope.lastName = "Doe"; });

$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  {{firstName + " " + lastName}} is an expression executed within 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 });

$Scope

$scope.emit/.on $rootScope = { } $rootScope = { } Index Controller $scope = { people: [{},{},{}] } Index Controller $scope = { people: [{},{},{}] } DIRECTIVE (RENDERING HTML!) ng-repeat="person in people" John Culviner Jane Doe, John Doe 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 } } Hey John changed! Refresh! 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)

Putting it on Together Contents taken from

Two way data Binding

$ngRoutes “Application routes in Angular are declared via the $routeProvider, which is the provider of the $route service. This service makes it easy to wire together controllers, view templates, and the current URL location in the browser. Using this feature, we can implement deep linking, which lets us utilize the browser's history (back and forward navigation) and bookmarks.” - Angularjs.org var phonecatApp = angular.module(’phonecatApp', [ 'ngRoute', ’OtherDepedencies' ]);

$ngRoutes phonecatApp.config(['$routeProvider', function($routeProvider) { $routeProvider. when('/phones', { templateUrl: 'partials/phone-list.html', controller: 'PhoneListCtrl' }). when('/phones/:phoneId', { templateUrl: 'partials/phone-detail.html', controller: 'PhoneDetailCtrl' }). otherwise({ redirectTo: '/phones' }); }]);

$ngRoutes …. {{phone.name}} {{phone.snippet}} …. Full example can be found in

Single Page application MinutesIsh_DanWahlin_May2013.pdf

Single Page application