AngularJS basics презентация

Содержание

Agile practitioner Trainer Public speaker Extensive AngularJS user

Слайд 1AngularJS basics
Introduction to the popular framework


Слайд 2Agile practitioner
Trainer
Public speaker
Extensive AngularJS user


Слайд 3Agenda
Intro
View and controller
Directives and filters
Two-way data binding
Event handlers
RESTful services and $resource
Yeoman
Routing


Слайд 4Intro
Framework overview. Main concepts. Bootstrapping.


Слайд 5MVC
IoC container
Plain JS models
All-in-One
Modular design
Testing bundled
Directives


Слайд 6MVC
First introduced in 1979 by Trygve Reenskaug.
Splits the presentation from the

logic and the user input.

Controller

View

Model


Слайд 7Inversion of Control
Service
Dependency
Service
Injector
Dependency


Слайд 8Bootstrapping
TEMPLATE











CODE
angular.module('myApp', []);


Слайд 9View and controller
Controllers. Templates. Scopes.


Слайд 10Angular view




ng-repeat="phone in phones">
{{phone.name}}

{{phone.snippet}}







Слайд 11Controller
View
Model
Scope
Scope – the glue between model, view, and controller.


Слайд 12Angular controller
TEMPLATE

{{data}}

CODE
angular.module('myApp')
.controller('MyController',
function($scope) {
$scope.data

= {};
});

Слайд 13Directives and filters
Directives. ngRepeat. Filters.


Слайд 14Look and feel




created
{{event.child.id}}

by forking this plunk .



Слайд 15Forms of directives
Preferred
Element:
Argument:

also
Class:
Comment:

ng-include -->

Слайд 16ngRepeat


[{{$index + 1}}] {{friend.name}}

who is {{friend.age}}.



Слайд 17Filter


[{{$index

+ 1}}] {{friend.name}} who is {{friend.age}}.



Слайд 18Standard filters
currency
date
filter
json
limitTo

uppercase
number
orderBy
lowercase


Слайд 19Practice
#1


Слайд 20Task – goo.gl/grrTPW
Create an angular application (bootstrap with ng-app).
Create a controller

and a template.
Initialize the list of repos in the controller.
Display the data on the view as a list of panels where the following is displayed:
Repo’s full name that is a link to the repo,
Repo owner’s login ID and avatar,
Repo’s description.
Output only 10 repos that come first alphabetically, order by full name ascending.

Слайд 21Two-way data binding
ngModel


Слайд 22ngModel


Слайд 23Practice
#2


Слайд 24Task – goo.gl/CoqXPy
Update the application so that the filtering params can

be set on the page via inputs.
Default values should populate the inputs on load:
Filter: empty,
Sort by name: asc,
Limit: 10.
Each time any of the values changes, the displayed list updates accordingly.

Слайд 25Event handlers
Calling events from the view


Слайд 26Event handlers
TEMPLATE




CODE
angular.module('myApp')
.controller('MyController',
function($scope) {

$scope.do = function() { };
});

Слайд 27RESTful services and $resource
HTTP and RESTful services. Injecting services.


Слайд 28REST level
HTTP level
Client
Server
$resource
(ngResource)
RESTful resource
$http
XHR
HTTP server


Слайд 29angular.module('myApp')
.service('myService', function($resource) {
...
})

.controller('MyController', function($scope, myService)

{
...
});

Injecting services

ngRoute


Слайд 30Practice
#3


Слайд 31Task – goo.gl/75hgJq
Update the application so that it gets the list

of repos via the Github search API.
Add a panel with the search param that will allow to narrow the search request by:
Maximum repo size,
Minimum number of forks,
Minimum number of stars.
Add the “Search” button that will query the data based on the specified parameters.
Create a separate service named “Repository” for this and inject in the controller.
Using $resource get the following related data and add to each repo view:
Languages,
Contributors names and avatars.

Слайд 32Yeoman
Yeoman tool. Scaffolding. yo.


Слайд 33Yeomen Warders
aka Beefeaters


Слайд 34yo
Scaffolding
Grunt
Task runner
Bower
Dependency
management


Слайд 35Scaffolding is a technique, in which a specification is used to

generate source code.


Слайд 36Scaffolding tools examples


Слайд 37yo
npm install –g yo generator-angular


Слайд 38yo angular
AngularJS generators


Слайд 39Angular generators
angular:route
angular
(aka angular:app)
angular:controller (service, directive, …)


Слайд 40Your app
LiveReload
Minification
(HTML, CSS,
JS, ngmin, …)


Слайд 41Practice
#4


Слайд 42Task – goo.gl/yOC4Vx
Create an application using yo AngularJS generator.
Migrate the existing

code into this application using route and service generators. Use existing MainCtrl and main.html for your code.
Make sure the application runs on the Node JS server with the generated config.


Слайд 43Configuring services
Providers. Application phases.


Слайд 44Providers are used for services configuration.


Слайд 45Config
Run
Two execution phases


Слайд 46Example of a provider usage
angular.module('myApp', [])
.config(function($filterProvider) {
$filterProvider.register('myFilter', MyFilter);

});

Слайд 47Routing
Multiple views. $routeProvider. $routeParams.


Слайд 48partials/phone-list.html
/phones
$route
(ngRoute)






Page


Слайд 49$routeProvider
$routeProvider
.when('/phones', {
templateUrl: 'partials/phone-list.html',
controller: 'PhoneListCtrl'
})
.otherwise({

redirectTo: '/phones'
});

Слайд 50$routeParams
// Given:
// URL: http://server.com/index.html#/Chapter/1/Section/2?search=moby
// Route: /Chapter/:chapterId/Section/:sectionId

// Then
$routeParams ==> { chapterId: 1,

sectionId: 2, search: 'moby' }

Слайд 51Practice
#5


Слайд 52Task – goo.gl/nriURP
Next to each repo entry in the list add

the “Details” link.
Clicking on “Details” will navigate to the repo’s details page using AngularJS routing.
The page should contain the following information:
The same data that is shown for the repo in the repos list, plus
The list of contributors logins.
The page should also contain the “Back” link which will navigate back to the list of repos.
Try not to use yo angular:route.

Слайд 53http://kirbarn.blogpost.com kiryl.baranoshnik@gmail.com @kirbarn


Слайд 54References
http://docs.angularjs.org/tutorial/
http://www.angularjs.org
http://chabster.blogspot.com/2008/02/mvp-and-mvc-part-1.html


Обратная связь

Если не удалось найти и скачать презентацию, Вы можете заказать его на нашем сайте. Мы постараемся найти нужный Вам материал и отправим по электронной почте. Не стесняйтесь обращаться к нам, если у вас возникли вопросы или пожелания:

Email: Нажмите что бы посмотреть 

Что такое ThePresentation.ru?

Это сайт презентаций, докладов, проектов, шаблонов в формате PowerPoint. Мы помогаем школьникам, студентам, учителям, преподавателям хранить и обмениваться учебными материалами с другими пользователями.


Для правообладателей

Яндекс.Метрика