Validation in Angular 1.3 And other angular tidbits.

Slides:



Advertisements
Similar presentations
MWD1001 Website Production Using JavaScript with Forms.
Advertisements

JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
Wireless: WDDPublic Follow along with the code: (or download the Join Me app.
Dhananjay Microsoft MVP
AJAX & By – Anupama Sharma. Defining Ajax Ajax isn’t a technology. It’s really several technologies, each flourishing in its own right, coming together.
DT228/3 Web Development JSP: Directives and Scripting elements.
@lestersconyers #spsevents #spsphx SPS EVENTS PHX SharePoint and Angular Sitting in a Tree… LESTER SCONYERS.
USING ANGULARJS WITH SITEFINITY
1 Using jQuery JavaScript & jQuery the missing manual (Second Edition)
UNIT-V The MVC architecture and Struts Framework.
Windows.Net Programming Series Preview. Course Schedule CourseDate Microsoft.Net Fundamentals 01/13/2014 Microsoft Windows/Web Fundamentals 01/20/2014.
DHTML. What is DHTML?  DHTML is the combination of several built-in browser features in fourth generation browsers that enable a web page to be more.
Single Page Applications with AngluarJS Bill Wolff Rob Keiser
NextGen Technology upgrade – Synerizip - Sandeep Kamble.
4.1 JavaScript Introduction
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
Philly.NET Hands-on Labs JAVASCRIPT SERIES. July 9: JavaScript Syntax Visual Studio ◦Projects ◦Editors ◦Debugging ◦Script blocks ◦Minification and bundling.
HTML Forms and Scripts. Session overview What are forms? Static vs dynamic Client-side scripts –JavaScript.
Introduction to ArcGIS API for JavaScript
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
1 JavaScript. 2 What’s wrong with JavaScript? A very powerful language, yet –Often hated –Browser inconsistencies –Misunderstood –Developers find it painful.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
Developer TECH REFRESH 15 Junho 2015 #pttechrefres h Web Going Foward.
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
Tutorial 8 Programming with ActionScript 3.0. XP Objectives Review the basics of ActionScript programming Compare ActionScript 2.0 and ActionScript 3.0.
INTRODUCTION TO HTML5 Using jQuery with HTML5. Introducing jQuery  Although it is not a part of any W3C or WHATWG specification, jQuery performs an important.
Introduction to Angular JS Sergey Barskiy Working Class Nobody Level: Introductory.
Introduction to Programming the WWW I CMSC Summer 2003 Lecture 7.
Declaratively Producing Data Mash-ups Sudarshan Murthy 1, David Maier 2 1 Applied Research, Wipro Technologies 2 Department of Computer Science, Portland.
Microsoft Virtual Academy Stacey Mulcahy | Technical Evangelist Christopher Harrison | Content Developer.
1 JavaScript
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.
Canopy walk through Single-Page Apps (SPAs) Benjamin Howarth Freelancer, Code Gecko Umbraco UK Festival, Fri 30 th Oct 2015 CODE GECKO.
4. Javascript M. Udin Harun Al Rasyid, S.Kom, Ph.D Lab Jaringan Komputer (C-307) Desain.
Plug-in Architectures Presented by Truc Nguyen. What’s a plug-in? “a type of program that tightly integrates with a larger application to add a special.
 Web pages originally static  Page is delivered exactly as stored on server  Same information displayed for all users, from all contexts  Dynamic.
ANGULARJS A Gentle Introduction John Madison.NET User Group.
UNDERSTANDING YOUR OPTIONS FOR CLIENT-SIDE DEVELOPMENT IN OFFICE 365 Mark Rackley
Text INTRODUCTION TO ASP.NET. InterComm Campaign Guidelines CONFIDENTIAL Simply Server side language Simplified page development model Modular, well-factored,
 XML derives its strength from a variety of supporting technologies.  Structure and data types: When using XML to exchange data among clients, partners,
Chapter 1 Ionic Framework (overview) Front-end framework for developing hybrid mobile apps with HTML5 Yeunyong Kantanet School of Information and Communication.
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.
1 Using jQuery JavaScript & jQuery the missing manual (Second Edition)
AngularJS. What is AngularJS  Javascript Framework  MVC  for Rich Web Application Development  by Google.
AngularJS and SharePoint
ANGULAR 2. JavaScript is a high-level, dynamic, untyped, and interpreted programming language. JavaScript was originally developed in May 1995 by Brendan.
AngularJS By Alireza Mirian At HasinTech.. Why Angular at first place The reason something like Angular emerges: The path Web Standards have went through.
DHTML.
Angular JS and SharePoint
Programming Web Pages with JavaScript
Extra Course
Human Computer Interaction
AngularJS A Gentle Introduction John
Angular JS Training | Angular JS online Training at GoLogica
Haritha Dasari Josue Balandrano Coronel -
4. Javascript Pemrograman Web I Program Studi Teknik Informatika
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.
JavaScript Introduction
JavaScript an introduction.
Step by Step - AngularJS
jQuery The Easy JavaScript Nikolay Chochev Technical Trainer
Introduction to AngularJS
JQuery with ASP.NET.
Introduce to Angular 6 Present by: Võ Văn Hào
Web Client Side Technologies Raneem Qaddoura
05 | An Introduction to AngularJS
Presentation transcript:

Validation in Angular 1.3 And other angular tidbits

What is Angular?  AngularJS is a structural framework for dynamic web apps. It lets you use HTML as your template language and lets you extend HTML's syntax to express your application's components clearly and succinctly. Angular's data binding and dependency injection eliminate much of the code you would otherwise have to write. And it all happens within the browser, making it an ideal partner with any server technology.  Angular is what HTML would have been had it been designed for applications. HTML is a great declarative language for static documents. It does not contain much in the way of creating applications, and as a result building web applications is an exercise in what do I have to do to trick the browser into doing what I want?  The impedance mismatch between dynamic applications and static documents is often solved with:  a library - a collection of functions which are useful when writing web apps. Your code is in charge and it calls into the library when it sees fit. E.g., jQuery.  frameworks - a particular implementation of a web application, where your code fills in the details. The framework is in charge and it calls into your code when it needs something app specific. E.g., durandal, ember, etc.  Angular takes another approach. It attempts to minimize the impedance mismatch between document centric HTML and what an application needs by creating new HTML constructs. Angular teaches the browser new syntax through a construct we call directives. Examples include:  Data binding, as in {{}}.  DOM control structures for repeating/hiding DOM fragments.  Support for forms and form validation.  Attaching new behavior to DOM elements, such as DOM event handling.  Grouping of HTML into reusable components.  Developers Guide for AngularJS Developers Guide for AngularJS

What is Angular (cont.)?  Developed by Google  Started in 2009  Google rebuilt DoubleClick in Angular, DoubleClick is premium version of AdSense  Adoption is increasing  Active project with large eco-system  Supports modern browsers

Angular Benefits  Focuses on Separation of Concerns  Is very opinionated (there is a right way…)  Is very modularized and gives you a great way to organize your javascript code and break up work assignments to teams  Much of the heavy lifting (Dom Manipulation, dependency injection) is done for you  Allows you to create your own elements and attributes using directives  Easily extensible  Routing  Embraces testing

Angular application structure  Modules are a container for the different parts of your app  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.expressions  Controllers a Controller is a JavaScript constructor function that is used to augment the Angular Scope. Controllers are used to setup the initial state of the scope and add behavior to the scopeAngular Scope  Angular services are substitutable objects that are wired together using dependency injection (DI). You can use services to organize and share code across your app.dependency injection (DI)  A filter formats the value of an expression for display to the user.  At a high level, directives are markers on a DOM element (such as an attribute, element name, comment or CSS class) that tell AngularJS's HTML compiler ($compile) to attach a specified behavior to that DOM element or even transform the DOM element and its children including validation.

How do I use AngularJS?  I build web business applications some intranet, some out in the wild.  Backend is EF6, Web Api and one Odata app just for learning purposes  For larger apps use BreezeJS (which I highly recommend) for client communication with the server and it’s server side components.  Client side AngularJS, Bootstrap 3, Font Awesome, Angular-UI (jquery is required by Bootstrap, I rarely use)

Sample application Technician Activity Tracking  Requirements be able to have a technician enter the orders they worked on, the date worked, the hours for those orders, any issues encountered and any materials used.  Be able to enter over the web, ideally enter from smartphone

 Application entirely developed in Visual Studio 2013  Backend Web Api and an Odata Controller just for fun, using Owin startup for configuration, no global.asax  Client calls are all made using Angular resource module allowing interaction with RESTful service  3 controllers, one for the links at the top of the page, one for adding activities and one for viewing a grid of all activities  2 directives one for async validation of order number, one for validation of hours worked  1 factory which is just a façade over backend access  1 filter which is just a template function

Validation  What is demonstrated is only available in Angular 1.3 I highly recommend moving to 1.3  New directives ngMessages ngMessage  These directives detect validation errors on the ngModel object and allow simpler communication of the validation issues  Can be validation from either the standard HTML5 attributes and input types or custom directives including the ability to cross validate multiple controls.  Can be used to prevent form submission

The code  HTML Page   Work Date:   Work Date is required 

The code (continued)   Order Worked:   Order Number is required  Not a valid order number   Checking Order Number... 

The directive .directive('orderNumberValidator', ['datacontext', function (datacontext) {  return {  require: 'ngModel',  link: function ($scope, element, attrs, ngModel) {  ngModel.$asyncValidators.validOrderNumber = function (modelValue, viewValue) {  var val = modelValue || viewValue;  return datacontext.validateOrderNumber(val);  };  }  };  }]);

Comparative directive div class="form-group"> Test Me: Test string must be longer than four characters!.directive('myUiValidate', [function () { return { restrict: 'A', require: 'ngModel', link: function (scope, elm, attrs, ngModel) { var validateExpr = attrs.myUiValidate; if (!validateExpr){ return;} ngModel.$validators.validate = scope[validateExpr]; } }; }]) $scope.myTestFunction = function(value){ return value.length > 4 ; };