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

Similar documents
AngularJS Introduction

JavaScript Framework: AngularJS

AngularJS. Beginner's guide - part 1

3 Days Training Program

AngularJS AN INTRODUCTION. Introduction to the AngularJS framework

Creating Effective Websites using AngularJS

Single Page Applications using AngularJS

Design and Implementation of Single Page Application Based on AngularJS

ANGULARJS INTERVIEW QUESTIONS

ANGULARJS - MOCK TEST ANGULARJS MOCK TEST II

Financial. AngularJS. AngularJS. Download Full Version :

Financial. AngularJS. AngularJS.

Tim Roes. Android- & inovex in Karlsruhe. GDG Karlsruhe Co-Organizer.

Getting Started with

Dynamic Web Development

a Very Short Introduction to AngularJS

AngularJS. Beginner's guide - part 2

Nagaraju Bende

Web Application Development

Single Page Applications

AngularJS Fundamentals

HTML DOM IN ANGULARJS

JSON POST WITH PHP IN ANGULARJS

Unit V- Client and Server Side Frameworks

,

Introduction to AngularJS

"Charting the Course... Comprehensive Angular. Course Summary

AngularJS. CRUD Application example with AngularJS and Rails 4. Slides By: Jonathan McCarthy

Modern and Responsive Mobile-enabled Web Applications

AngularJS Examples pdf

Table of Contents. Introduction 1. 1 Jumping Into JavaScript 5. for Loops 17

AngularJS. CRUD Application example with AngularJS and Rails 4. Slides By: Jonathan McCarthy

Front End Programming

AngularJS Step By Step Tutorials. $interval([function], [delaytime], [count], [invokeapply], [parameter]);

P a g e 1. Danish Technological Institute. Scripting and Web Languages Online Course k Scripting and Web Languages

IN4MATX 133: User Interface Software

EXPRESSIONS IN ANGULARJS

AngularJS Intro Homework

Frontend Frameworks. SWE 432, Fall 2016 Design and Implementation of Software for the Web

Addison-Wesley Learning Series

Understanding Angular Directives By Jeffry Houser

About the Tutorial. Audience. Prerequisites. Disclaimer & Copyright. AngularJS

A WEB BASED OFFICE MARKET. CS 297 Project Report Presented to Dr. Christopher Pollett San José State University

UI Course HTML: (Html, CSS, JavaScript, JQuery, Bootstrap, AngularJS) Introduction. The World Wide Web (WWW) and history of HTML

Angular 2 Programming

Questions and Answers from Lukas Ruebbelke s AngularJS In-Depth Course

Building Web Applications

Comprehensive AngularJS Programming (5 Days)

A conditional statement can compare two values. Here we check if one variable we declared is greater than another. It is true so the code executes.

Full Stack Web Developer

Introduction to. Angular. Prof. Dr.-Ing. Thomas Wiedemann.

Simple AngularJS thanks to Best Practices

THE HITCHHIKERS GUIDE TO. Harper Maddox CTO, EdgeTheory 30 September 2014

Tarek Elachkar, VP Customer Solutions - Jahia A real world story of Angular and Apache Unomi integration.

Using AngularJS In APEX. Dan McGhan Senior Technical Consultant

input[datetime-local] DIRECTIVE IN ANGULARJS

A Model-Driven Development of Web Applications Using AngularJS Framework

One Framework. Angular

Angular 4 Training Course Content

ANGULAR 2.X,4.X + TYPESRCIPT by Sindhu

About Me. Name: Jonathan Brown. Job: Full Stack Web Developer. Experience: Almost 3 years of experience in WordPress development

ADVANCED JAVASCRIPT #8

By the end of this Angular 6 tutorial, you'll learn by building a real world example application:

CS142 Winter 2017 Midterm Grading Solutions and Rubric

Source. Developer Guide / forms

Sample CS 142 Midterm Examination

IONIC. The Missing SDK For Hybrid Apps. Mike

Ten good practices for ASP.NET MVC applications

Vue.js Framework. Internet Engineering. Spring Pooya Parsa Professor: Bahador Bakhshi CE & IT Department, Amirkabir University of Technology

Sample CS 142 Midterm Examination

Model-View-Whatever A COMPARISON OF JAVASCRIPT MVC/MVP/MVVM FRAMEWORKS. J. Tower

Angular 2: What s new? Jonas Bandi, IvoryCode GmbH

All India Council For Research & Training

Html5 Css3 Javascript Interview Questions And Answers Pdf >>>CLICK HERE<<<

Full Stack Web Developer

Source. Developer Guide / module

Software Architecture Documentation for the JRC MYGEOSS app for Invasive Species project

Practical Course: Web Development Angular JS Part I Winter Semester 2016/17. Juliane Franze

Modern Web Application Development. Sam Hogarth

Sample CS 142 Midterm Examination

Lazy Loading Techniques

Future Web App Technologies

D3 + Angular JS = Visual Awesomesauce

Etanova Enterprise Solutions

Angular 2 and TypeScript Web Application Development

Front End. Presentation Layer. UI (User Interface) User <==> Data access layer

COMS W3101: SCRIPTING LANGUAGES: JAVASCRIPT (FALL 2018)

Web Software Model CS 4640 Programming Languages for Web Applications

Advantages: simple, quick to get started, perfect for simple forms, don t need to know how form model objects work

Templates and Databinding. SWE 432, Fall 2017 Design and Implementation of Software for the Web

Building JSR-286 portlets using AngularJS and IBM Web Experience Factory

FRONT END WEB. {< Course Details >}

MEAN Stack. 1. Introduction. 2. Foundation a. The Node.js framework b. Installing Node.js c. Using Node.js to execute scripts

Understanding this structure is pretty straightforward, but nonetheless crucial to working with HTML, CSS, and JavaScript.

COMS W3101: SCRIPTING LANGUAGES: JAVASCRIPT (FALL 2017)

PHP WITH ANGULAR CURRICULUM. What you will Be Able to Achieve During This Course

React Not Just Hype!

Web Technologies II + Project Management for Web Applications

Sample Copy. Not For Distribution.

Getting MEAN. with Mongo, Express, Angular, and Node SIMON HOLMES MANNING SHELTER ISLAND

Transcription:

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

What we used previously. Allows for DOM Manipulation Does not provide structure to your code Does not allow for two way binding

What we used previously.

<p>select value: {{ thevalue }}</p> <select ng-model="thevalue"> <option value="1">1</option> <option value="2">2</option> </select> <p>select value: <span id="thevalue"></span></p> <select id="theselect"> <option value="1">1</option> <option value="2">2</option> </select> $(function() { $('#theselect').on('change', function() { var value = $(this).val(); $('#thevalue').text(value); } });

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

Simple Example <html ng-app> <head> <script src='angular.min.js'></script> </head> <body> <input ng-model='user.name'> <div ng-show='user.name'>hi {{user.name}}</div> </body> </html>

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

MVC Model JS Objects View DOM Controller JS Classes

Bootstrapping

Expressions AngularJS binds data to HTML using Expressions. <div> </div> <p>my first expression: {{ 5 + 5 }}</p> <div ng-app="" ng-init="points=[1,15,19,2,40]"> <p>the third item is <span ng-bind="points[2]"></span></p> </div>

Directives AngularJS lets you extend HTML with new attributes called Directives. <div ng-app="" ng-init="firstname='john'"> <p>name: <input type="text" ng-model="firstname"></p> <p ng-bind="firstname"></p> </div> https://docs.angularjs.org/api/ng/directive

Directives <div ng-app="" ng-init="names=[ {name:'jani',country:'norway'}, {name:'hege',country:'sweden'}, {name:'kai',country:'denmark'}]"> <ul> <li ng-repeat= x in names"> {{ x.name + ', ' + x.country }} </li> </ul> </div>

Controllers AngularJS controllers control the data of AngularJS applications. <div ng-app="myapp" ng-controller="personctrl"> First Name: <input type="text" ngmodel="firstname"><br> Last Name: <input type="text" ngmodel="lastname"><br> <br> Full Name: {{fullname()}} </div> <script> var app = angular.module('myapp', []); app.controller('personctrl', function($scope) { $scope.firstname = "John"; $scope.lastname = "Doe"; $scope.fullname = function() { return $scope.firstname + " " + $scope.lastname; } }); </script>

Filters Filter is used to do some transformation of the scoped Data. Filter is applied using the symbol (pipe). Filter Description currency Format a number to a currency format. filter Select a subset of items from an array. lowercase Format a string to lower case. orderby Orders an array by an expression. uppercase Format a string to upper case. <div ng-app="myapp" ng-controller="costctrl"> <input type="number" ng-model="quantity"> <input type="number" ng-model="price"> <p>total = {{ (quantity * price) currency }}</p> </div>

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. <div ng-app="myapp" ng-controller="customersctrl"> <ul> <li ng-repeat="x in names"> {{ x.name + ', ' + x.country }} </li> </ul> </div> <script> var app = angular.module('myapp', []); app.controller('customersctrl', function($scope, $http) { $http.get("http://www.w3schools.com/angular/customers.php").success(function(response) {$scope.names = response.records;}); }); </script>

Modules A module is a container for the different parts of an application. All application controllers should belong to a module. <body> <div ng-app="myapp" ng-controller="myctrl"> {{ firstname + " " + lastname }} </div> <script> var app = angular.module("myapp", []); app.controller("myctrl", function($scope) { $scope.firstname = "John"; $scope.lastname = "Doe"; }); </script> </body>

$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 });

$rootscope = { $scope.emit/.on } 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 } } 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 https://docs.angularjs.org/tutorial/step_04

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. <ul class="phones"> <li ng-repeat="phone in phones filter:query orderby:orderprop" class="thumbnail"> <a href="#/phones/{{phone.id}}" class="thumb"><img ngsrc="{{phone.imageurl}}"></a> <a href="#/phones/{{phone.id}}">{{phone.name}}</a> <p>{{phone.snippet}}</p> </li> </ul>. Full example can be found in https://docs.angularjs.org/tutorial/step_07

Single Page application http://fastandfluid.com/publicdownloads/ AngularJSIn60MinutesIsh_DanWahlin_May2013.pdf

Single Page application