This document provides a style guide and best practices for developing AngularJS applications. It discusses topics such as wrapping code in immediately invoked function expressions (IIFEs) to avoid namespace collisions, using the controllerAs syntax over $scope, placing logic in services rather than controllers, and debugging techniques like inspecting scopes and using breakpoints. Common errors encountered in AngularJS development are also covered, along with their potential causes and solutions.
This presentation has been prepared by Oleksii Prohonnyi for internal Angular.js training to improve skills of newbies in JS/Angular.
Part 1 (Introduction): http://www.slideshare.net/oprohonnyi/dive-into-angular-part-1-introduction
Part 2 (Architecture): http://www.slideshare.net/oprohonnyi/dive-into-angular-part-2-architecture
Part 3 (Performance): http://www.slideshare.net/oprohonnyi/dive-into-angular-part-3-performance
Part 5 (Experience): https://www.slideshare.net/oprohonnyi/dive-into-angular-part-5-experience
Angular EE - Special Workshop by Nir KaufmanNir Kaufman
Slides from the 'Angular EE' workshop.
This workshop was all about architecture, Angular module patterns and state management using NGRX - redux inspired library for Angular on top of RxJS
Presentation made for the NG-CONF Israel 2015
(http://ng-conf.co.il/)
Angular2 is just around the corner.. so, how can we prepare our angular 1.x code base to the migration?
An example project that come along with those slides available on Github (links inside)
This presentation has been prepared by Oleksii Prohonnyi for internal Angular.js training to improve skills of newbies in JS/Angular.
Part 1 (Introduction): http://www.slideshare.net/oprohonnyi/dive-into-angular-part-1-introduction
Part 2 (Architecture): http://www.slideshare.net/oprohonnyi/dive-into-angular-part-2-architecture
Part 3 (Performance): http://www.slideshare.net/oprohonnyi/dive-into-angular-part-3-performance
Part 5 (Experience): https://www.slideshare.net/oprohonnyi/dive-into-angular-part-5-experience
Angular EE - Special Workshop by Nir KaufmanNir Kaufman
Slides from the 'Angular EE' workshop.
This workshop was all about architecture, Angular module patterns and state management using NGRX - redux inspired library for Angular on top of RxJS
Presentation made for the NG-CONF Israel 2015
(http://ng-conf.co.il/)
Angular2 is just around the corner.. so, how can we prepare our angular 1.x code base to the migration?
An example project that come along with those slides available on Github (links inside)
This is an introduction to Angular with answers to common questions. We’ll see what Angular is, the various versions of Angular and the new features of version 9
This is the companion slides for the Front-End.IL meetup talk that took place on May 12 2015 @ Google campus TLV.
Learn how to set up an ES6 development environment with minimal effort, using modern tools like JSPM and webpack.
Grab the code here:
https://github.com/nirkaufman/es6-up-and-running
Angular is an open source JavaScript framework that is used to build single page based web applications.A detailed overview of Angular 4, Its features, development environment and components.
Getting Started with Angular 4 and TypeScript
Slides:
1- What is TypeScript.
2- TypeScript Content
3- Why TypeScript
4- TypeScript Interfaces
5- TypeScript Decorators
6- TypeScript Import and Export
7- What is Angular JS
8- Angular Architecture Overview
9- Anatomy of an Angular Application
10- Setting up an Angular Application
11- Angular CLI
12- Running your application
13- Modules
14- Components
15- Templates
16- Metadata
17- Data binding
18- Pipes
19- Services and Service Creation
This presentation has been prepared by Oleksii Prohonnyi for internal Angular.js training to improve skills of newbies in JS/Angular.
Part 1 (Introduction): http://www.slideshare.net/oprohonnyi/dive-into-angular-part-1-introduction
Part 2 (Architecture): http://www.slideshare.net/oprohonnyi/dive-into-angular-part-2-architecture
Part 3 (Performance): http://www.slideshare.net/oprohonnyi/dive-into-angular-part-3-performance
Part 4 (Angular 2.0): http://www.slideshare.net/oprohonnyi/dive-into-angular-part-4-angular-20
Angular continues to be one of the most popular frameworks for building modern web applications. The impending release of Angular version 4 has many developers in a panic. What is Angular version 4? What happened to version 3? Do I have to learn a bunch of new stuff? Will my code break?
Well, fear not Angular fans. We have answers and more. In this mini-session, we'll explain where we came from and where we are going. And more importantly, we have code samples. We will show you some of the latest cool stuff including the new *ngIf, animations, TypeScript 2.2 support, and the revised router. And prove to you most of the changes to Angular are pretty modest and shouldn't require much if any code changes.
This is an introduction to Angular with answers to common questions. We’ll see what Angular is, the various versions of Angular and the new features of version 9
This is the companion slides for the Front-End.IL meetup talk that took place on May 12 2015 @ Google campus TLV.
Learn how to set up an ES6 development environment with minimal effort, using modern tools like JSPM and webpack.
Grab the code here:
https://github.com/nirkaufman/es6-up-and-running
Angular is an open source JavaScript framework that is used to build single page based web applications.A detailed overview of Angular 4, Its features, development environment and components.
Getting Started with Angular 4 and TypeScript
Slides:
1- What is TypeScript.
2- TypeScript Content
3- Why TypeScript
4- TypeScript Interfaces
5- TypeScript Decorators
6- TypeScript Import and Export
7- What is Angular JS
8- Angular Architecture Overview
9- Anatomy of an Angular Application
10- Setting up an Angular Application
11- Angular CLI
12- Running your application
13- Modules
14- Components
15- Templates
16- Metadata
17- Data binding
18- Pipes
19- Services and Service Creation
This presentation has been prepared by Oleksii Prohonnyi for internal Angular.js training to improve skills of newbies in JS/Angular.
Part 1 (Introduction): http://www.slideshare.net/oprohonnyi/dive-into-angular-part-1-introduction
Part 2 (Architecture): http://www.slideshare.net/oprohonnyi/dive-into-angular-part-2-architecture
Part 3 (Performance): http://www.slideshare.net/oprohonnyi/dive-into-angular-part-3-performance
Part 4 (Angular 2.0): http://www.slideshare.net/oprohonnyi/dive-into-angular-part-4-angular-20
Angular continues to be one of the most popular frameworks for building modern web applications. The impending release of Angular version 4 has many developers in a panic. What is Angular version 4? What happened to version 3? Do I have to learn a bunch of new stuff? Will my code break?
Well, fear not Angular fans. We have answers and more. In this mini-session, we'll explain where we came from and where we are going. And more importantly, we have code samples. We will show you some of the latest cool stuff including the new *ngIf, animations, TypeScript 2.2 support, and the revised router. And prove to you most of the changes to Angular are pretty modest and shouldn't require much if any code changes.
Agenda:
1- Introduction: basic description and overview about what is angular and why we should use it.
2- AngularJS Core Features: key features of angularJS.
3- Guides and help: API and documentation references, in addition of online courses.
Presentation about new Angular 9.
It gives introduction about angular framework.
Provides information about why we use angular,
additional features and fixes from old versions. It will clearly explain how to create a new angular project and how to use angular commands and their usages.
It will also explain about the key components like angular architecture, routing, dependency injection etc.,
Angular-Js is a JavaScript-based open-source front-end web application framework mainly maintained by Google and by a community of individuals and corporations to address many of the challenges encountered in developing single-page applications.
AngularJS, a MVW framework from Google is based on JavaScript, a language globally known to millions of developers worldwide - thus giving it a much lower learning curve even for complete beginners. Integrating AngularJS is simple as it evaluates page once HTML is in the DOM and make easier to bind Angular on top of existing applications. It can run along with Node.js, an asynchronous development platform with lightning speed execution, which makes building Mean Stack applications easier and faster. AngularJS comes with a very good documentation and also have wide range of third party modules making it user-friendly for developers.
AngularJS is an open source web application framework. It was originally developed in 2009 by Misko Hevery and Adam Abrons. It is now maintained by Google. Its latest version is 1.4.4 .
Are you ready to embark on an exciting journey into web development? Angular for Beginners is a comprehensive introductory course designed to empower you with the skills and knowledge needed to build dynamic and responsive web applications using the Angular framework.
Angular, developed and maintained by Google, is a powerful front-end framework that simplifies the process of building robust and feature-rich single-page applications. This course is specifically tailored for individuals with little to no prior experience in web development, providing a gentle and hands-on introduction to Angular's core concepts and principles.
Key Learning Objectives:
Introduction to Web Development:
Explore the fundamental concepts of web development, including HTML, CSS, and JavaScript.
Understand the role of front-end frameworks in building modern web applications.
Getting Started with Angular:
Set up your development environment and create your first Angular project.
Familiarize yourself with the Angular CLI (Command Line Interface).
Understanding Angular Architecture:
Learn about the building blocks of Angular applications, including components, modules, and services.
Grasp the concept of data binding and how it facilitates communication between components.
Templates and Directives:
Dive into Angular templates and explore the usage of directives for dynamic content rendering.
Understand the role of structural directives like *ngIf and *ngFor.
Component Communication:
Master the art of communication between Angular components using input and output properties.
Explore the concept of parent-child and sibling component communication.
Forms and User Input:
Learn how to create reactive forms and handle user input effectively.
Validate and submit forms using Angular's form handling capabilities.
Routing and Navigation:
Implement client-side navigation using Angular Router.
Understand how to create and navigate between multiple views in a single-page application.
Services and Dependency Injection:
Explore the role of services in Angular applications.
Understand the concept of dependency injection and how it promotes code reusability.
Introduction to HTTP and Observables:
Communicate with a server using Angular's HttpClient module.
Handle asynchronous operations with Observables.
Deployment and Best Practices:
Learn how to deploy your Angular application to a hosting platform.
Explore best practices for structuring and maintaining Angular code.
By the end of this course, you will have gained a solid foundation in Angular and be well-equipped to take your first steps in the world of web development. Join us on this exciting journey, and let's build amazing web applications together!
London SF Developers: Custom Lightning Component Error HandlingRichard Clark
aka Essential Eight Lessons for Error Handling in Lightning Custom Component Development.
Covering some of the common pitfalls of handling errors when developing Lightning Components and my own modest recommendations for how you can avoid them, plus some best practices. As part of my role at Provar I get asked to investigate when our customer's tests are seen to be failing in order to diagnose whether the fault is in Salesforce or a missing feature of Provar. I've learned the astonishing ways in which people are publishing code for Lightning Components without basic error handling to a point I'd argue is irresponsible! This led me down a deeper and deeper rabbit hole which, like Alice, I'd like to share so you can all safely reach the Lightning Wonderland!
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. AngularJS'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.
4. 4
Single Responsibility [Style Y001]
Avoid putting app modules, controllers, factories in the same file
Recommended 1 Component Per File
5. 5
IIFE [Style Y010]
Wrap angular module inside immediately invoke function expression (IIFE)
Why? An IIFE removes variables from the global scope. This helps prevent
variables and function declarations from living longer than expected in
the global scope, which also helps avoid variable collisions.
Why?: When your code is minified and bundled into a single file for
deployment to a production server, you could have collisions of variables
and many global variables. An IIFE protects you against both of these by
providing variable scope for each file.
Strict mode : cannot use
undeclared variable
6. 6
Definition of Modules (Setters) [Style Y021]
Avoid using a variable name when declare module
Why? With 1 Component Per File,
there is rarely a need to introduce
a variable for the module
Recommended to use a simpler setter syntax
7. 7
Getters [Style Y022]
Avoid using a variable name when using module
Recommended to use chaining with the getter syntax
Why? This produces more readable code and avoids variable
collisions or leaks
8. 8
controllerAs view syntax [Style Y030]
Avoid using classic controller with $scope syntax
Use the controllerAs syntax
Why?: It promotes the use of binding to a "dotted" object in the View (e.g.
customer.name instead of name), which is more contextual, easier to
read, and avoids any reference issues that may occur without "dotting".
9. 9
controllerAs with “self” [Style Y032]
*** NOTE : In Our Project, use “self” instead of “vm” for consistency
Use a capture variable for “this” when using the controllerAs syntax. Choose
a consistent variable name such as vm, which stands for ViewModel
var self = this;
self.name = {};
self.sendMessage = function() {};
10. 10
Function Declarations to Hide Implementation
Details [Style Y034]
Why?: You never have to worry
with function declarations that
moving var a before var b will
break your code because a
depends on b.
Why?: Move the complexity
out of view so can see
important stuff up top
Why?: Easier to read and
identify which function can
be bound to view
Why?: Order is critical with
function expressions
example of function expression :
var a = function() { };
var b = function() { };
11. 11
Defer Controller Logic to Services [Style Y035]
Why?: Logic may be reused by multiple controllers when placed
within a service and exposed via a function.
Why?: Removes dependencies and hides implementation
details from the controller.
12. 12
Order of Dependency Injection
Put angular built in service at the front and self-defined service at
the back
Why?: Improve readability and consistency
<input type="text" ng-model=“{{name}}” my-directive=“{{data}}” />
14. 14
Tips on Debugging AngularJS
> Use scope inspection tools
Always press command+option+I (Mac) or Ctrl+Shift+I (Windows)
> Inspect Element
- Install AngularJS Batarang extension in Chrome
- Select the element and inspect angular scope
15. 15
Tips on Debugging AngularJS
Place breakpoints at certain lines of code for debug
> Use chrome debugging tools
16. 16
Tips on Debugging AngularJS
Sometimes sass syntax error might cause live-reload failure
> Check on Ionic CLI
> Use jshint in Atom for checking javascript syntax in real time
18. 18
Failed to instantiate module…
Solution :
- check for app.js & index.html
- ensure no spelling mistake
- ‘account.ctrlx’ should be ‘account.ctrl’
- ‘account-ctrlx.js’ should be ‘account-ctrl.js’
- or have you accidentally remove the <script> tag but loaded in module?
19. 19
XxxxxCtrl is not a function
Solution :
- check for app.js & index.html
- ensure ‘account.ctrl’ is included as dependency in app.js
- and <script src=“path/to/account-ctrl.js”></script> is in index.html
Cause :
- occurs when you have defined
the controller but did not
include it in app.js/index.html
21. 21
$xxxxx is not defined
Solution :
- add it into the .controller() function
Cause :
- usually occurs when use a certain
service without injecting it
- eg : we use $location but didn’t
define it inside .controller() function
22. 22
Unexpected Token }
Cause :
- usually occurs when accidentally add extra comma (,) at the end
of JSON file (eg. in locale JSON file)
Solution :
- Remove the comma (,) at the
last string value
23. 23
CORS Issue When Serving in Desktop Browser
Solution :
- Install CORS extension in chrome
- Remember to turn it on
Note :
- Remember to turn off if didn’t use
- It might affect other page loading