SlideShare a Scribd company logo
Malang Frontend Developer
Pengenalan AngularJs
(versi 1.5.x)
Presented by : Edi Santoso
Events :
Meetup 5 February 2016
Dilo Malang
About Me
angular.module('profile')
.controller('ProfileCtrl', function ProfileCtrl($scope, profileService) {
'use strict';
$scope.profile = {
Name: 'Edi Santoso',
Current: 'Lead Developer at Kodesoft',
Past: 'Frontend Developer at PT Alfasoft',
Education: 'only graduates of vocational high schools',
Summary: 'I have more than 3 years of being in the ' +
'web development with some of the capabilities of the frontend and' +
'the backend technology.',
Email: 'edicyber@gmail.com',
Site: 'http://kodesoft.co.id/',
Github: 'https://github.com/cyberid41',
LinkedIn: 'https://id.linkedin.com/in/cyberid41',
Twitter: 'http://twitter.com/cyberid41'
};
});
February '16 Meetup Malang Frontend Developer
Why Angular?
To create properly architectured and
maintainable web applications
February '16 Meetup Malang Frontend Developer
Why Angular?
Defines numerous ways to organize
web application at client side
February '16 Meetup Malang Frontend Developer
Why Angular?
Encourage MVC/MVVM design
pattern
February '16 Meetup Malang Frontend Developer
Why Angular?
Good for Single Page Apps
February '16 Meetup Malang Frontend Developer
Why Angular?
https://github.com/showcases/front-end-javascript-frameworks
February '16 Meetup Malang Frontend Developer
Key Features
● Declarative HTML approach
● Easy Data Binding : Two way Data Binding
● Reusable Components
● MVC/MVVM Design Pattern
● Dependency Injection
● End to end Integration Testing / Unit Testing
February '16 Meetup Malang Frontend Developer
Key Features
● Routing
● Templating
● Modules
● Services
● Expressions
● Filters
● Directives
● Form Validation
February '16 Meetup Malang Frontend Developer
Declarative HTML
<!doctype html>
<html ng-app="todoApp">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js"></script>
<script src="todo.js"></script>
<link rel="stylesheet" href="todo.css">
</head>
<body>
<h2>Todo</h2>
<div ng-controller="TodoListController as todoList">
<span>{{todoList.remaining()}} of {{todoList.todos.length}} remaining</span>
[ <a href="" ng-click="todoList.archive()">archive</a> ]
<ul class="unstyled">
<li ng-repeat="todo in todoList.todos">
<input type="checkbox" ng-model="todo.done">
<span class="done-{{todo.done}}">{{todo.text}}</span>
</li>
</ul>
<form ng-submit="todoList.addTodo()">
<input type="text" ng-model="todoList.todoText" size="30"
placeholder="add new todo here">
<input class="btn-primary" type="submit" value="add">
</form>
</div>
</body>
</html>
February '16 Meetup Malang Frontend Developer
Declarative HTML
<!doctype html>
<html ng-app="todoApp">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js"></script>
<script src="todo.js"></script>
<link rel="stylesheet" href="todo.css">
</head>
<body>
<h2>Todo</h2>
<div ng-controller="TodoListController as todoList">
<span>{{todoList.remaining()}} of {{todoList.todos.length}} remaining</span>
[ <a href="" ng-click="todoList.archive()">archive</a> ]
<ul class="unstyled">
<li ng-repeat="todo in todoList.todos">
<input type="checkbox" ng-model="todo.done">
<span class="done-{{todo.done}}">{{todo.text}}</span>
</li>
</ul>
<form ng-submit="todoList.addTodo()">
<input type="text" ng-model="todoList.todoText" size="30"
placeholder="add new todo here">
<input class="btn-primary" type="submit" value="add">
</form>
</div>
</body>
</html>
February '16 Meetup Malang Frontend Developer
Declarative HTML
<!doctype html>
<html ng-app="todoApp">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js"></script>
<script src="todo.js"></script>
<link rel="stylesheet" href="todo.css">
</head>
<body>
<h2>Todo</h2>
<div ng-controller="TodoListController as todoList">
<span>{{todoList.remaining()}} of {{todoList.todos.length}} remaining</span>
[ <a href="" ng-click="todoList.archive()">archive</a> ]
<ul class="unstyled">
<li ng-repeat="todo in todoList.todos">
<input type="checkbox" ng-model="todo.done">
<span class="done-{{todo.done}}">{{todo.text}}</span>
</li>
</ul>
<form ng-submit="todoList.addTodo()">
<input type="text" ng-model="todoList.todoText" size="30"
placeholder="add new todo here">
<input class="btn-primary" type="submit" value="add">
</form>
</div>
</body>
</html>
February '16 Meetup Malang Frontend Developer
Declarative Javascript
angular.module('todoApp', [])
.controller('TodoListController', function() {
var todoList = this;
todoList.todos = [
{text:'learn angular', done:true},
{text:'build an angular app', done:false}];
todoList.addTodo = function() {
todoList.todos.push({text:todoList.todoText, done:false});
todoList.todoText = '';
};
todoList.remaining = function() {
var count = 0;
angular.forEach(todoList.todos, function(todo) {
count += todo.done ? 0 : 1;
});
return count;
};
todoList.archive = function() {
var oldTodos = todoList.todos;
todoList.todos = [];
angular.forEach(oldTodos, function(todo) {
if (!todo.done) todoList.todos.push(todo);
});
};
});
Model View Controller (MVC)
Model View View Model (MVVM)
Data Binding and Interaction
Data Binding and Interaction
Scopes
Scope is an object that refers to the
application model. It is an execution
context for expressions.
Scopes
angular.module('scopeExample', [])
.controller('MyController', ['$scope', function($scope) {
$scope.username = 'World';
$scope.sayHello = function() {
$scope.greeting = 'Hello ' + $scope.username + '!';
};
}]);
// HTML
<div ng-controller="MyController">
Your name:
<input type="text" ng-model="username">
<button ng-click='sayHello()'>greet</button>
<hr>
{{greeting}}
</div>
Controllers
Controller is defined by a JavaScript
constructor function that is used to
augment the Angular Scope
Controllers
// javascript
var myApp = angular.module('myApp',[]);
myApp.controller('GreetingController', ['$scope', function($scope) {
$scope.greeting = 'Hola!';
}]);
// HTML
<div ng-controller="MyController">
Your name:
<input type="text" ng-model="username">
<button ng-click='sayHello()'>greet</button>
<hr>
{{greeting}}
</div>
Services
Angular services are substitutable
objects that are wired together
using dependency injection (DI).
Services
angular.
module('myServiceModule', []).
controller('MyController', ['$scope','notify', function ($scope, notify) {
$scope.callNotify = function(msg) {
notify(msg);
};
}]).
factory('notify', ['$window', function(win) {
var msgs = [];
return function(msg) {
msgs.push(msg);
if (msgs.length == 3) {
win.alert(msgs.join("n"));
msgs = [];
}
};
}]);
<div id="simple" ng-controller="MyController">
<p>Let's try this simple notify service, injected into the controller...</p>
<input ng-init="message='test'" ng-model="message" >
<button ng-click="callNotify(message);">NOTIFY</button>
<p>(you have to click 3 times to see an alert)</p>
</div>
Directives
<ul class="phones">
<li ng-repeat="phone in phones | filter:query | orderBy:orderProp">
<span>{{phone.name}}</span>
<p>{{phone.snippet}}</p>
</li>
</ul>
ngRepeat
Filters
<ul class="phones">
<li ng-repeat="phone in phones | filter:query | orderBy:orderProp">
<span>{{phone.name | uppercase}}</span>
<p>{{phone.snippet}}</p>
</li>
</ul>
Filters - Uppercase
Modules
Modules and ngApp
<div ng-app="myApp">
<div>
{{ 'World' | greet }}
</div>
</div>
// declare a module
var myAppModule = angular.module('myApp', []);
// configure the module.
// in this example we will create a greeting filter
myAppModule.filter('greet', function() {
return function(name) {
return 'Hello, ' + name + '!';
};
});
Dependency Injection
Dependency Injection (DI) is a software
design pattern that deals with how
components get hold of their
dependencies.
Dependency Injection
Dependency Injection (DI) is a software
design pattern that deals with how
components get hold of their
dependencies.
Dependency Injection
// services
var phonecatServices = angular.module('phonecatServices', ['ngResource']);
phonecatServices.factory('Phone', ['$resource',
function($resource){
return $resource('phones/:phoneId.json', {}, {
query: {method:'GET', params:{phoneId:'phones'}, isArray:true}
});
}]);
// controller
var phonecatControllers = angular.module('phonecatControllers', []);
phonecatControllers.controller('PhoneListCtrl', ['$scope', 'Phone', function($scope, Phone)
{
$scope.phones = Phone.query();
$scope.orderProp = 'age';
}]);
Routing
var phonecatApp = angular.module('phonecatApp', [
'ngRoute',
'phonecatControllers'
]);
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'
});
}]);
Finish...
Credits
http://www.slideshare.net/bolshchikov/angularjs-basics-with-example
http://www.slideshare.net/sbegaudeau/angular-js-101-everything-you-need-to-know-to-get-started
http://www.slideshare.net/manishekhawat/angularjs-22960631
https://docs.angularjs.org/
https://www.google.co.id/
Our Community
Malang PHP
https://www.facebook.com/groups/mphug/
MalangJs
https://www.facebook.com/groups/malangjs/
Official sites
http://malangphp.org/
Stay in touch...
@cyberid41
fb.com/cyberid41
id.linkedin.com/in/cyberid41
http://github.com/cyberid41
Stay in touch...

More Related Content

What's hot

Dependency Management with RequireJS
Dependency Management with RequireJSDependency Management with RequireJS
Dependency Management with RequireJS
Aaronius
 
Twitter bootstrap
Twitter bootstrapTwitter bootstrap
Twitter bootstrap
dennisdc
 

What's hot (20)

[FEConf Korea 2017]Angular 컴포넌트 대화법
[FEConf Korea 2017]Angular 컴포넌트 대화법[FEConf Korea 2017]Angular 컴포넌트 대화법
[FEConf Korea 2017]Angular 컴포넌트 대화법
 
Javascript session june 2013 (iii) jquery json
Javascript session june 2013 (iii) jquery   jsonJavascript session june 2013 (iii) jquery   json
Javascript session june 2013 (iii) jquery json
 
JavaScript Library Overview
JavaScript Library OverviewJavaScript Library Overview
JavaScript Library Overview
 
Coisas para o blog
Coisas para o blogCoisas para o blog
Coisas para o blog
 
Devoxx 2014-webComponents
Devoxx 2014-webComponentsDevoxx 2014-webComponents
Devoxx 2014-webComponents
 
dojo.Patterns
dojo.Patternsdojo.Patterns
dojo.Patterns
 
Introducing jQuery
Introducing jQueryIntroducing jQuery
Introducing jQuery
 
jQuery in the [Aol.] Enterprise
jQuery in the [Aol.] EnterprisejQuery in the [Aol.] Enterprise
jQuery in the [Aol.] Enterprise
 
Declarative and standards-based web application development with the Ample SDK
Declarative and standards-based web application development with the Ample SDKDeclarative and standards-based web application development with the Ample SDK
Declarative and standards-based web application development with the Ample SDK
 
State of jQuery '08
State of jQuery '08State of jQuery '08
State of jQuery '08
 
Dependency Management with RequireJS
Dependency Management with RequireJSDependency Management with RequireJS
Dependency Management with RequireJS
 
Dart and AngularDart
Dart and AngularDartDart and AngularDart
Dart and AngularDart
 
Angular js routing options
Angular js routing optionsAngular js routing options
Angular js routing options
 
JQuery
JQueryJQuery
JQuery
 
Starting with jQuery
Starting with jQueryStarting with jQuery
Starting with jQuery
 
AngulrJS Overview
AngulrJS OverviewAngulrJS Overview
AngulrJS Overview
 
Web internship Yii Framework
Web internship  Yii FrameworkWeb internship  Yii Framework
Web internship Yii Framework
 
Ext JS Introduction
Ext JS IntroductionExt JS Introduction
Ext JS Introduction
 
Twitter bootstrap
Twitter bootstrapTwitter bootstrap
Twitter bootstrap
 
Jquery Basics
Jquery BasicsJquery Basics
Jquery Basics
 

Viewers also liked

Blnin formation-blender-les-bases
Blnin formation-blender-les-basesBlnin formation-blender-les-bases
Blnin formation-blender-les-bases
CERTyou Formation
 
Tenemos derechos humanos
Tenemos derechos humanosTenemos derechos humanos
Tenemos derechos humanos
Alan Gomez
 
Boletín Informativo 09 de Agosto 2009
Boletín Informativo 09 de Agosto 2009Boletín Informativo 09 de Agosto 2009
Boletín Informativo 09 de Agosto 2009
Fundación San Rafael
 
Recursos fotograficos
Recursos fotograficosRecursos fotograficos
Recursos fotograficos
Debora
 
Los mejores precios en Internet Preciolandia . Visitanos
Los mejores precios en Internet Preciolandia . VisitanosLos mejores precios en Internet Preciolandia . Visitanos
Los mejores precios en Internet Preciolandia . Visitanos
sleet3alarm
 
Xcode magazine 3
Xcode magazine 3Xcode magazine 3
Xcode magazine 3
Andi Ria
 
Cnil - Guide Travail
Cnil - Guide TravailCnil - Guide Travail
Cnil - Guide Travail
foxshare
 

Viewers also liked (20)

Blnin formation-blender-les-bases
Blnin formation-blender-les-basesBlnin formation-blender-les-bases
Blnin formation-blender-les-bases
 
Los Carteles Luminosos Para Tiendas Y Comercios Atraen Mas La Atencion
Los Carteles Luminosos Para Tiendas Y Comercios Atraen Mas La Atencion
Los Carteles Luminosos Para Tiendas Y Comercios Atraen Mas La Atencion
Los Carteles Luminosos Para Tiendas Y Comercios Atraen Mas La Atencion
 
Tenemos derechos humanos
Tenemos derechos humanosTenemos derechos humanos
Tenemos derechos humanos
 
Cv eric
Cv ericCv eric
Cv eric
 
Transsexuel(le)s : conditions et style de vie, santé perçue et comportements ...
Transsexuel(le)s : conditions et style de vie, santé perçue et comportements ...Transsexuel(le)s : conditions et style de vie, santé perçue et comportements ...
Transsexuel(le)s : conditions et style de vie, santé perçue et comportements ...
 
documento del proyecto
documento del proyectodocumento del proyecto
documento del proyecto
 
Boletín Informativo 09 de Agosto 2009
Boletín Informativo 09 de Agosto 2009Boletín Informativo 09 de Agosto 2009
Boletín Informativo 09 de Agosto 2009
 
Catalogo desayunos de gustó
Catalogo desayunos de gustóCatalogo desayunos de gustó
Catalogo desayunos de gustó
 
Royal brinkman partner day
Royal brinkman partner dayRoyal brinkman partner day
Royal brinkman partner day
 
Recursos fotograficos
Recursos fotograficosRecursos fotograficos
Recursos fotograficos
 
Overview of the data pilot and OpenAIRE tools, Elly Dijk and Marjan Grootveld...
Overview of the data pilot and OpenAIRE tools, Elly Dijk and Marjan Grootveld...Overview of the data pilot and OpenAIRE tools, Elly Dijk and Marjan Grootveld...
Overview of the data pilot and OpenAIRE tools, Elly Dijk and Marjan Grootveld...
 
Business Video Marketing Report: The Definitive B2B Marketer’s Guide to Using...
Business Video Marketing Report: The Definitive B2B Marketer’s Guide to Using...Business Video Marketing Report: The Definitive B2B Marketer’s Guide to Using...
Business Video Marketing Report: The Definitive B2B Marketer’s Guide to Using...
 
Estrategias para potenciar la competencia lectora
Estrategias para potenciar la competencia lectoraEstrategias para potenciar la competencia lectora
Estrategias para potenciar la competencia lectora
 
Taller herramientas de comunicación para mejorar la gestión de las organizaci...
Taller herramientas de comunicación para mejorar la gestión de las organizaci...Taller herramientas de comunicación para mejorar la gestión de las organizaci...
Taller herramientas de comunicación para mejorar la gestión de las organizaci...
 
Los mejores precios en Internet Preciolandia . Visitanos
Los mejores precios en Internet Preciolandia . VisitanosLos mejores precios en Internet Preciolandia . Visitanos
Los mejores precios en Internet Preciolandia . Visitanos
 
Presentación Pasarela Punta del Este 2015
Presentación Pasarela Punta del Este 2015Presentación Pasarela Punta del Este 2015
Presentación Pasarela Punta del Este 2015
 
Xcode magazine 3
Xcode magazine 3Xcode magazine 3
Xcode magazine 3
 
Cnil - Guide Travail
Cnil - Guide TravailCnil - Guide Travail
Cnil - Guide Travail
 
MascoWeb
MascoWebMascoWeb
MascoWeb
 
Atajos autocad
Atajos autocadAtajos autocad
Atajos autocad
 

Similar to Pengenalan AngularJS

Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Jeado Ko
 
Private slideshow
Private slideshowPrivate slideshow
Private slideshow
sblackman
 

Similar to Pengenalan AngularJS (20)

Angular directive filter and routing
Angular directive filter and routingAngular directive filter and routing
Angular directive filter and routing
 
HTML5 New and Improved
HTML5   New and ImprovedHTML5   New and Improved
HTML5 New and Improved
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
Angular js - 4developers 12 kwietnia 2013
Angular js - 4developers 12 kwietnia 2013Angular js - 4developers 12 kwietnia 2013
Angular js - 4developers 12 kwietnia 2013
 
Built in filters
Built in filtersBuilt in filters
Built in filters
 
Angular js
Angular jsAngular js
Angular js
 
Workshop 12: AngularJS Parte I
Workshop 12: AngularJS Parte IWorkshop 12: AngularJS Parte I
Workshop 12: AngularJS Parte I
 
Introduction to angular js
Introduction to angular jsIntroduction to angular js
Introduction to angular js
 
AngularJS Mobile Warsaw 20-10-2014
AngularJS Mobile Warsaw 20-10-2014AngularJS Mobile Warsaw 20-10-2014
AngularJS Mobile Warsaw 20-10-2014
 
AngularJs Superheroic JavaScript MVW Framework Services by Miracle Studios
AngularJs Superheroic JavaScript MVW Framework Services by Miracle StudiosAngularJs Superheroic JavaScript MVW Framework Services by Miracle Studios
AngularJs Superheroic JavaScript MVW Framework Services by Miracle Studios
 
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJSAngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
 
Gradle for Android Developers
Gradle for Android DevelopersGradle for Android Developers
Gradle for Android Developers
 
How to Mess Up Your Angular UI Components
How to Mess Up Your Angular UI ComponentsHow to Mess Up Your Angular UI Components
How to Mess Up Your Angular UI Components
 
Building iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoBuilding iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" Domino
 
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
 
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점 Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
 
Private slideshow
Private slideshowPrivate slideshow
Private slideshow
 
AngularJS interview questions
AngularJS interview questionsAngularJS interview questions
AngularJS interview questions
 
Opencast Admin UI - Introduction to developing using AngularJS
Opencast Admin UI - Introduction to developing using AngularJSOpencast Admin UI - Introduction to developing using AngularJS
Opencast Admin UI - Introduction to developing using AngularJS
 
준비하세요 Angular js 2.0
준비하세요 Angular js 2.0준비하세요 Angular js 2.0
준비하세요 Angular js 2.0
 

Recently uploaded

How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 

Recently uploaded (20)

How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfA Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
 
Studiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareStudiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting software
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Kraków
 
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Breaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdfBreaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdf
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 

Pengenalan AngularJS

  • 2. About Me angular.module('profile') .controller('ProfileCtrl', function ProfileCtrl($scope, profileService) { 'use strict'; $scope.profile = { Name: 'Edi Santoso', Current: 'Lead Developer at Kodesoft', Past: 'Frontend Developer at PT Alfasoft', Education: 'only graduates of vocational high schools', Summary: 'I have more than 3 years of being in the ' + 'web development with some of the capabilities of the frontend and' + 'the backend technology.', Email: 'edicyber@gmail.com', Site: 'http://kodesoft.co.id/', Github: 'https://github.com/cyberid41', LinkedIn: 'https://id.linkedin.com/in/cyberid41', Twitter: 'http://twitter.com/cyberid41' }; });
  • 3. February '16 Meetup Malang Frontend Developer Why Angular? To create properly architectured and maintainable web applications
  • 4. February '16 Meetup Malang Frontend Developer Why Angular? Defines numerous ways to organize web application at client side
  • 5. February '16 Meetup Malang Frontend Developer Why Angular? Encourage MVC/MVVM design pattern
  • 6. February '16 Meetup Malang Frontend Developer Why Angular? Good for Single Page Apps
  • 7. February '16 Meetup Malang Frontend Developer Why Angular? https://github.com/showcases/front-end-javascript-frameworks
  • 8. February '16 Meetup Malang Frontend Developer Key Features ● Declarative HTML approach ● Easy Data Binding : Two way Data Binding ● Reusable Components ● MVC/MVVM Design Pattern ● Dependency Injection ● End to end Integration Testing / Unit Testing
  • 9. February '16 Meetup Malang Frontend Developer Key Features ● Routing ● Templating ● Modules ● Services ● Expressions ● Filters ● Directives ● Form Validation
  • 10. February '16 Meetup Malang Frontend Developer Declarative HTML <!doctype html> <html ng-app="todoApp"> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js"></script> <script src="todo.js"></script> <link rel="stylesheet" href="todo.css"> </head> <body> <h2>Todo</h2> <div ng-controller="TodoListController as todoList"> <span>{{todoList.remaining()}} of {{todoList.todos.length}} remaining</span> [ <a href="" ng-click="todoList.archive()">archive</a> ] <ul class="unstyled"> <li ng-repeat="todo in todoList.todos"> <input type="checkbox" ng-model="todo.done"> <span class="done-{{todo.done}}">{{todo.text}}</span> </li> </ul> <form ng-submit="todoList.addTodo()"> <input type="text" ng-model="todoList.todoText" size="30" placeholder="add new todo here"> <input class="btn-primary" type="submit" value="add"> </form> </div> </body> </html>
  • 11. February '16 Meetup Malang Frontend Developer Declarative HTML <!doctype html> <html ng-app="todoApp"> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js"></script> <script src="todo.js"></script> <link rel="stylesheet" href="todo.css"> </head> <body> <h2>Todo</h2> <div ng-controller="TodoListController as todoList"> <span>{{todoList.remaining()}} of {{todoList.todos.length}} remaining</span> [ <a href="" ng-click="todoList.archive()">archive</a> ] <ul class="unstyled"> <li ng-repeat="todo in todoList.todos"> <input type="checkbox" ng-model="todo.done"> <span class="done-{{todo.done}}">{{todo.text}}</span> </li> </ul> <form ng-submit="todoList.addTodo()"> <input type="text" ng-model="todoList.todoText" size="30" placeholder="add new todo here"> <input class="btn-primary" type="submit" value="add"> </form> </div> </body> </html>
  • 12. February '16 Meetup Malang Frontend Developer Declarative HTML <!doctype html> <html ng-app="todoApp"> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js"></script> <script src="todo.js"></script> <link rel="stylesheet" href="todo.css"> </head> <body> <h2>Todo</h2> <div ng-controller="TodoListController as todoList"> <span>{{todoList.remaining()}} of {{todoList.todos.length}} remaining</span> [ <a href="" ng-click="todoList.archive()">archive</a> ] <ul class="unstyled"> <li ng-repeat="todo in todoList.todos"> <input type="checkbox" ng-model="todo.done"> <span class="done-{{todo.done}}">{{todo.text}}</span> </li> </ul> <form ng-submit="todoList.addTodo()"> <input type="text" ng-model="todoList.todoText" size="30" placeholder="add new todo here"> <input class="btn-primary" type="submit" value="add"> </form> </div> </body> </html>
  • 13. February '16 Meetup Malang Frontend Developer Declarative Javascript angular.module('todoApp', []) .controller('TodoListController', function() { var todoList = this; todoList.todos = [ {text:'learn angular', done:true}, {text:'build an angular app', done:false}]; todoList.addTodo = function() { todoList.todos.push({text:todoList.todoText, done:false}); todoList.todoText = ''; }; todoList.remaining = function() { var count = 0; angular.forEach(todoList.todos, function(todo) { count += todo.done ? 0 : 1; }); return count; }; todoList.archive = function() { var oldTodos = todoList.todos; todoList.todos = []; angular.forEach(oldTodos, function(todo) { if (!todo.done) todoList.todos.push(todo); }); }; });
  • 15. Model View View Model (MVVM)
  • 16. Data Binding and Interaction
  • 17. Data Binding and Interaction
  • 18. Scopes Scope is an object that refers to the application model. It is an execution context for expressions.
  • 19. Scopes angular.module('scopeExample', []) .controller('MyController', ['$scope', function($scope) { $scope.username = 'World'; $scope.sayHello = function() { $scope.greeting = 'Hello ' + $scope.username + '!'; }; }]); // HTML <div ng-controller="MyController"> Your name: <input type="text" ng-model="username"> <button ng-click='sayHello()'>greet</button> <hr> {{greeting}} </div>
  • 20. Controllers Controller is defined by a JavaScript constructor function that is used to augment the Angular Scope
  • 21. Controllers // javascript var myApp = angular.module('myApp',[]); myApp.controller('GreetingController', ['$scope', function($scope) { $scope.greeting = 'Hola!'; }]); // HTML <div ng-controller="MyController"> Your name: <input type="text" ng-model="username"> <button ng-click='sayHello()'>greet</button> <hr> {{greeting}} </div>
  • 22. Services Angular services are substitutable objects that are wired together using dependency injection (DI).
  • 23. Services angular. module('myServiceModule', []). controller('MyController', ['$scope','notify', function ($scope, notify) { $scope.callNotify = function(msg) { notify(msg); }; }]). factory('notify', ['$window', function(win) { var msgs = []; return function(msg) { msgs.push(msg); if (msgs.length == 3) { win.alert(msgs.join("n")); msgs = []; } }; }]); <div id="simple" ng-controller="MyController"> <p>Let's try this simple notify service, injected into the controller...</p> <input ng-init="message='test'" ng-model="message" > <button ng-click="callNotify(message);">NOTIFY</button> <p>(you have to click 3 times to see an alert)</p> </div>
  • 24. Directives <ul class="phones"> <li ng-repeat="phone in phones | filter:query | orderBy:orderProp"> <span>{{phone.name}}</span> <p>{{phone.snippet}}</p> </li> </ul> ngRepeat
  • 25. Filters <ul class="phones"> <li ng-repeat="phone in phones | filter:query | orderBy:orderProp"> <span>{{phone.name | uppercase}}</span> <p>{{phone.snippet}}</p> </li> </ul> Filters - Uppercase
  • 26. Modules Modules and ngApp <div ng-app="myApp"> <div> {{ 'World' | greet }} </div> </div> // declare a module var myAppModule = angular.module('myApp', []); // configure the module. // in this example we will create a greeting filter myAppModule.filter('greet', function() { return function(name) { return 'Hello, ' + name + '!'; }; });
  • 27. Dependency Injection Dependency Injection (DI) is a software design pattern that deals with how components get hold of their dependencies.
  • 28. Dependency Injection Dependency Injection (DI) is a software design pattern that deals with how components get hold of their dependencies.
  • 29. Dependency Injection // services var phonecatServices = angular.module('phonecatServices', ['ngResource']); phonecatServices.factory('Phone', ['$resource', function($resource){ return $resource('phones/:phoneId.json', {}, { query: {method:'GET', params:{phoneId:'phones'}, isArray:true} }); }]); // controller var phonecatControllers = angular.module('phonecatControllers', []); phonecatControllers.controller('PhoneListCtrl', ['$scope', 'Phone', function($scope, Phone) { $scope.phones = Phone.query(); $scope.orderProp = 'age'; }]);
  • 30. Routing var phonecatApp = angular.module('phonecatApp', [ 'ngRoute', 'phonecatControllers' ]); 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' }); }]);