Presentation is loading. Please wait.

Presentation is loading. Please wait.

Services in AngularJS Telerik Software Academy

Similar presentations


Presentation on theme: "Services in AngularJS Telerik Software Academy"— Presentation transcript:

1 Services in AngularJS Telerik Software Academy http://academy.telerik.com

2 Table of Contents What is a service Why using services Custom services Built-in services

3 What Is a Service

4 In Angular service is A worker object Easier use of different aspects of the app Over-the-Wire or not Often stateless

5 Why Using Services

6 Services are: Reusable "SOLID" Dependency Injection Testable

7 Custom Services

8 Three types Factory – the returned value Service – returns instance of the function Provider – can be configured module.service('serviceName', function (args) { // implement service }); module.provider('providerName', function (args) { // implement service });

9 Custom Services Inject it in a controller module.factory('serviceName', function (services){ // implement service }); myApp.controller('Ctrl', function Ctrl($scope, serviceName) { // use service } );

10 Built-in Services

11 $http – AJAX request $resource – AJAX with restfull services $q – Promise library $anchorScroll – Scrolls to element $cacheFactory – cache service (key-value pair) $compile – compiles element with directives $parse – parses expressions $locale – localization of dates, numbers $timeout – timeout with compiling $exceptionHandler – handling exceptions $filter – access to filter functions $cookieStore – cookie sessions usage

12 Built-in Services Other Built-in Services $interpolate – modifies the {{ template $log – logs into the console $rootScope – the "base" scope (avoid using it) $window – the window $document – the document DOM element $rootElement – the root of the app $route – for routes $routeParams – retrieve route parameters $location – parses the URL $httpBackend – fake HTTP (for testing) $controller – instantiates controllers

13 13 Summary Angular services Custom services Built-in services

14 форум програмиране, форум уеб дизайн курсове и уроци по програмиране, уеб дизайн – безплатно програмиране за деца – безплатни курсове и уроци безплатен SEO курс - оптимизация за търсачки уроци по уеб дизайн, HTML, CSS, JavaScript, Photoshop уроци по програмиране и уеб дизайн за ученици ASP.NET MVC курс – HTML, SQL, C#,.NET, ASP.NET MVC безплатен курс "Разработка на софтуер в cloud среда" BG Coder - онлайн състезателна система - online judge курсове и уроци по програмиране, книги – безплатно от Наков безплатен курс "Качествен програмен код" алго академия – състезателно програмиране, състезания ASP.NET курс - уеб програмиране, бази данни, C#,.NET, ASP.NET курсове и уроци по програмиране – Телерик академия курс мобилни приложения с iPhone, Android, WP7, PhoneGap free C# book, безплатна книга C#, книга Java, книга C# Николай Костов - блог за програмиране http://academy.telerik.com


Download ppt "Services in AngularJS Telerik Software Academy"

Similar presentations


Ads by Google