SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQueryAngularJS AngularJS is a client-side JavaScript Framework for adding interactivity to HTML.

Slides:



Advertisements
Similar presentations
JQuery MessageBoard. Lets use jQuery and AJAX in combination with a database to update and retrieve information without refreshing the page. Here we will.
Advertisements

JavaScript and AJAX Jonathan Foss University of Warwick
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
The Web Warrior Guide to Web Design Technologies
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
1 Using jQuery JavaScript & jQuery the missing manual (Second Edition)
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
Single Page Applications with AngluarJS Bill Wolff Rob Keiser
PHP Tutorials 02 Olarik Surinta Management Information System Faculty of Informatics.
JavaScript Form Validation
Reading Data in Web Pages tMyn1 Reading Data in Web Pages A very common application of PHP is to have an HTML form gather information from a website's.
JavaScript, jQuery & AJAX. What is JavaScript? An interpreted programming language with object oriented capabilities. Not Java! –Originally called LiveScript,
JavaScript & jQuery the missing manual Chapter 11
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
SYST Web Technologies SYST Web Technologies Lesson 6 – Intro to JavaScript.
WEEK 3 AND 4 USING CLIENT-SIDE SCRIPTS TO ENHANCE WEB APPLICATIONS.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
Javascript: More features B. Ramamurthy 7/4/2014B. Ramamurthy, CSE651C1.
Review IDIA 619 Spring 2013 Bridget M. Blodgett. HTML A basic HTML document looks like this: Sample page Sample page This is a simple sample. HTML user.
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
Javascript. Outline Introduction Fundamental of JavaScript Javascript events management DOM and Dynamic HTML (DHTML)

1 JavaScript in Context. Server-Side Programming.
Using Client-Side Scripts to Enhance Web Applications 1.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
Forms and Server Side Includes. What are Forms? Forms are used to get user input We’ve all used them before. For example, ever had to sign up for courses.
 HTML is hypertext markup language. It is a way for people to display their information with more complex pictures and text displays. Before HTML, messages.
JavaScript, jQuery, and Mashups Incorporating JavaScript, jQuery, and other Mashups into existing pages.
Microsoft Virtual Academy Stacey Mulcahy | Technical Evangelist Christopher Harrison | Content Developer.
ANGULARJS A Gentle Introduction John /
Overview of Form and Javascript fundamentals. Brief matching exercise 1. This is the software that allows a user to access and view HTML documents 2.
JavaScript Scripting language What is Scripting ? A scripting language, script language, or extension language is a programming language.
Controllers and Markup Controllers, $scope, Markup, Directives, Expressions, Binding, Filters, Validation SoftUni Team Technical Trainers Software University.
HTML Forms. Slide 2 Forms (Introduction) The purpose of input forms Organizing forms with a and Using different element types to get user input A brief.
Chapter 2: Variables, Functions, Objects, and Events JavaScript - Introductory.
JQuery JavaScript is a powerful language but it is not always easy to work with. jQuery is a JavaScript library that helps with: – HTML document traversal.
4. Javascript M. Udin Harun Al Rasyid, S.Kom, Ph.D Lab Jaringan Komputer (C-307) Desain.
1 JavaScript in Context. Server-Side Programming.
Introduction to HTML. _______________________________________________________________________________________________________________ 2 Outline Key issues.
JQuery and AJAX WEB Technologies : PHP Programming Language.
IS2802 Introduction to Multimedia Applications for Business Lecture 07: Introduction to jQuery Rob Gleasure
Unit 13 –JQuery Basics Instructor: Brent Presley.
JavaScript. JavaScript Introduction JavaScript is the world's most popular programming language. It is the language for HTML and the web, for servers,
Understanding JavaScript and Coding Essentials Lesson 8.
Let’s demonstrate some KRAD Action Components Kuali University: Apply Now Lab 3: Actions Lab Objectives Understand how to setup an action that invokes.
AJAX – Asynchronous JavaScript And XML By Kranthi Kiran Nuthi CIS 764 Kansas State University.
Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.
AJAX CS456 Fall Examples Where is AJAX used? Why do we care?
Chapter 1 Ionic Framework (overview) Front-end framework for developing hybrid mobile apps with HTML5 Yeunyong Kantanet School of Information and Communication.
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
JQUERY AND AJAX
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
SHAREPOINT SATURDAY PRESENTATION by Keith Rimington REAL EXPERIENCES WITH ANGULARJS AND SHAREPOINT.
LECTURE #4: JQUERY AND FORM VALIDATION Josh Kaine Josh Kaine 4/1/2016.
Getting Started with Angular 2 and TypeScript Nebraska.Code() 2016 Spencer Schneidenbach Ryvit.
HTML Tutorial. What is HTML HTML is a markup language for describing web documents (web pages) HTML documents are described by HTML tags Each HTML tag.
1 Using jQuery JavaScript & jQuery the missing manual (Second Edition)
11 jQuery Web Service Client. 22 Objectives You will be able to Use JSON (JavaScript Object Notation) for communcations between browser and server methods.
AngularJS. What is AngularJS  Javascript Framework  MVC  for Rich Web Application Development  by Google.
© 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.
CMPE 280 Web UI Design and Development November 7 Class Meeting
The Cliff Notes Version
Jessica Betts, Sophia Pandey, & Ryan Amundson
Javascript and JQuery SRM DSC.
AngularJS Michael Kang August 20th 2015.
Lecture 12: The Fetch Api and AJAx
PART 1.
Web Programming and Design
Presentation transcript:

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQueryAngularJS AngularJS is a client-side JavaScript Framework for adding interactivity to HTML Some features & benefits: Keeps your JavaScript more simple and organized Plays nice with jQuery Fast Promotes maintainable software Note: These slides and what we go over today is just the tip of the iceberg. This is just to get you started and does not cover many best practices, code organization, etc. I recommend taking an online class on AngularJS (links on the website).

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQueryAngularJS Client-Side AngularJS is for front-end (client-side) development only. You can use it with JavaScript and/or jQuery to manipulate the DOM, make web service calls, etc. Communicates with Server-Side AngularJS, like jQuery and JavaScript, can be written to communicate with a back-end (server-side) API.

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQuery Getting Started Go to angularjs.org and grab the AngularJS JavaScript file to include in your web page.

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQuery Debugging Angular If you get an error message in your console, it's probably not going to be very readable. To make it easier to debug your application, temporarily include the non-minified AngularJS file in your HTML.

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQueryDirectives A directive connects an HTML tag to JavaScript code. You can mark an HTML tag with a directive that is associated with a JavaScript function.

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQueryModules A module contains a part of your application. You can have multiple modules, each separated logically into different sections. This helps keep your code organized and maintainable. var app = angular.module('myApp', [ ]); app.js Create a module Name Dependency Injection Leave empty for now yourPage.html Directive

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQueryExpressions Expressions are written directly into your HTML page. They are wrapped in double curly brackets {{ your expression }} Try these: {{“hello” + “, world!”}} = {{2 + 2}} In order for this to work, you will need to have a module in place to tell Angular that you want the expressions inside your module's HTML to be evaluated.

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQueryControllers Controllers let you define properties and functions and attach them to your HTML. app.controller(“MyAppController”, function() { this.someProperty = “someValue”; });

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQueryControllers Your controller's name should be camel case and have “Controller” at the end app.controller(“MyAppController”, function() { this.someProperty = “someValue”; });

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQueryControllers The second parameter is an anonymous function. It will be executed when the controller is called in the HTML. app.controller(“MyAppController”, function() { this.someProperty = “someValue”; });

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQueryControllers Set property values and make functions associated with your controller app.controller(“MyAppController”, function() { this.someProperty = “someValue”; this.someFunction = function (param1, param2) {... } });

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQueryClosure Wrap the whole thing in a JavaScript closure. This creates a separate scope for the code contained in the closure, and the () at the end means the function will be executed right after it's read. (function () { var app = angular.module(“myApp”, [ ]); app.controller(“MyAppController”, function() { }); })();

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQueryng-controller You have your controller defined in JavaScript, now attach it to your HTML. You pick which part of your HTML you want to use the controller. {{appCtrl.title}} “as appCtrl” gives the MyAppController an alias of “appCtrl”

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQuery ng-show and ng-hide Directives Toggle the visibility of an element based on an expression...

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQuery ng-repeat Directive Loop over items in an array with ng-repeat: {{product.name}} {{product.price}}

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQuery ng-click Directive Evaluate an expression when an element is clicked: You have selected product #{{selected}} First Product Second Product This is a silly example, not very useful, but it demonstrates ng-click.

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQuery 2-Way Data Binding AngularJS supports 2-way data binding. You can display (read) the value of a property on the screen using an expression. Additionally, if you change the value of a property (like we just did with ng- click) or allow the user to enter a value for the property into an input field, it will be immediately updated everywhere else on the screen and in the markup. This is where things start getting pretty cool!!

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQuery 2-Way Data Binding – Silly Example This will create a button that complains if you click it too many times. The code is simple – it's all right here (though you do have to create your module and put it in an ng-app directive). Thanks for clicking! = 5”> Stop clicking me!! Click

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQuery 2-Way Data Binding – Silly Example That example is fine, it works (even if it's nonsense), but there is only so much logic we can put inside ng-click before it gets ugly. Instead, use a controller: Thanks for clicking! = 5”> Stop clicking me!! Click

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQueryng-class Hello This span will have the CSS class special applied to it if the expression myCtrl.isSpecial evaluates to true.

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQueryng-src Important note regarding images: If you want to specify the URL to an image using an AngularJS expression, you cannot simply type: Due to timing of when the image loads vs when the expression is evaluated, you have to use the ng-src directive:

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQueryFilters Make a price look like a currency using a filter: {{product.price | currency}} The pipe here is much like a pipe in UNIX commands. This means “send the output of the first expression into the second expression.” currency is an expression built into AngularJS. Options – Some filters let you specify options {{ someDate | date:'MM/dd/yyyy' }}

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQueryFilters Other filters available: currency date json limitTo lowercase number orderBy uppercase

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQuery ng-model Directive Hello, {{firstName}}! Bind a form element to a property

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQueryServices AngularJS has built in services for web service calls, logging, etc. One way to make a web service call, similar to how we did it with jQuery: $http.get('URL', {parameter:value, parameter:value}).success(function(data) { //callback });

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQuery Dependency Injection You can't use the $http service in AngularJS at first. You have to inject it into your controller like so: app.controller('MyAppController', ['$http', function($http) { }]);