반응형
반응형

[마소] 2013.07 Angular.JS - 서비스들과 의존성 주입

 

AngularJS의 서비스는 특정 기능을 담당하는 객체들을 서비스라고 한다.

공통된 특정 작업을 수행하는 싱글톤(singleton) 객체다.

singleton은 인스턴스가 단 1개만 존재하는 것을 보증하는 디자인 패턴이다.

예를 들어 기본 서비스로 제공하는 $http service  는 브라우저의 낮은 레벨에 해당하는 XMLHttpRequest 객체의 기능을 제공한다.

 

Angular services are singletons that carry out specific tasks common to web apps, such as the$http service that provides low level access to the browser'sXMLHttpRequest object.

 

To use an Angular service, you identify it as a dependency for the dependent (a controller, or another service) that depends on the service. Angular's dependency injection subsystem takes care of the rest. The Angular injector subsystem is in charge of service instantiation, resolution of dependencies, and provision of dependencies to factory functions as requested.

 

service

  • $anchorScroll  HTML5 spec에 지정된 규칙과 location hash의 현재 값에 따라 관련 요소의 
                               스크롤 처리를 한다.
  • $cacheFactory 캐시화할 객체를 관리한다.
  • $compile         HTML문자열이나 DOM의 템플릿을 스코프에 연결하도록 컴파일한다.
  • $controller       콘트롤러를 인스턴스화 한다.
  • $document       JQuery(lite)로 감싼 window.document 이다.
  • $exceptionHandler  angularJS에서 감지되는 모든 예외가 위임된다.
  • $filter                     정보 표현에 대한 formatting 처리를 한다.
  • $http                     XMLHttpReqeust 또는 JSONP에 대한 기능을 제공한다.
  • $httpBackend    테스트하는 경우 $http에 대한 대체처리가 된다. 직접 호출은 불가하다.
  • $interpolate     $compile의 처리와 같이 데이터 바인딩의 처리를 컴파일한다.
  • $locale        다국어 규칙을 제공한다.
  • $location     window.location 보다 발전된 기능을 제공한다. (HTML5 처리 등)
  • $log            로깅을 처리한다.
  • $parse        AngularJS 표현식으로 변환한다.
  • $q              Kris Kowal's Q(promise/deferred)와 동일한 기능을 제공한다.
  • $rootElement  AngularJS APP의 루트 요소를 얻는다.
  • $rootScope    AngularJS APP의 루트 스코프를 얻는다.
  • $route           URL을 감시해 해당 경로의 컨트롤러와 뷰를 mapping한다.
  • $routeParams  URL상의 파라미터를 관리한다.
  • $templateCache HTML templete을 cache한다.
  • $timeout     window.setTimeout과 같은 기능을 하지만 $exceptionHadler와 연동 처리된다.
  • $window   전역 변수 오염의 방지와 테스트를 위해 브라우저의 window와
                         동일한 기능을 하는 객체를 제공한다.
  •  

     

     

    * 의존성 주입 (Dependency Injection)
    의존성 주입 적용으로 얻을 수 있는 이점

    - 종속성의 설정을 컴파일 시에서 실행 시로 조정해 모듈 간의 결합도를 낮출 수 있다.

    - 여러 곳에서 사용 중인 모듈을 소스 코드의 수정없이 사용할 수 있어 재사용율이 높다.

    - 모의 객체 등을 이용한 단위 테스트 시 편의성을 높여준다.

     

    의존성 주입 패턴

    - 생산자 주입 : 필요한 의존성을 모두 포함하는 클래스의 생성자를 만들고, 그 생성자를 통해 의존성을 주입한다.(new 연산자를 통한 생성)

    - 세터(setter)를 통한 주입 : 의존성을 입력받는 세터 메소드를 만들어 의존성을 중비한다.

    - 인터페이스를 통한 주입 : 의존성을 주입하는 함수가 포함된 인터페이스를 작성하고, 이를 구현하도록 함으로써 실행 시 의존성을 주입한다.

     

     

     

     

     

    반응형
    반응형

    20 Most Popular Responsive jQuery Plugins

     

    1. LetteringJS

    Lettering JS

    Lettering.js is a beautifully scripted jQuery plugin for typography. Lettering.js has superseded the conventional way of including the typography fonts on the website with a very fast script coded in jQuery.

     

    2. TypeheadJS

    Typehead.js

    Like Google, you can also enable your websites search bar to suggest the results for the desired query. This Jquery plugin, powered by Twitter, namely Typehead.js has made it possible to make your search bar function like that.

     

    3. StellarJS

    Steller.js

    Stellar.js is a jQuery plugin that provides parallax scrolling effects to any scrolling element.

     

    4. Perfect-Scrollbar

    Perfect Scroll bar

    This plugin transforms your standard scroll bar into a sleek and trendy one. You can adjust the color according to your need.

     

    5. DropZoneJS

    Dropzone

    DropzoneJS is an open source library that provides drag’n'drop file uploads with image previews. It’s synonymous to the WordPress upload area.

     

    6. FitText

    Fittext

    FittextJS has been a very successful plugin for displaying gigantic texts on the display screen. Earlier to FittextJS, images were used by the website designers which caused conflicts on the basis of responsiveness, but, now this plugin has not only hastened the process but also has solved the problem of responsiveness.

     

    7. Swipe.js

    Swipe

    Swipe is a perfect responsive slider suitable for websites desiring a full width slider below the header. Some of its features are responsiveness, resistant bounds and scroll prevention.

     

    8. FlexNav

    FlexNav

    FlexNav is perhaps the best Jquery plugin for responsive menus. Easy to setup and easy personalization are its key features.

     

    9. Flexisel

    Flexisel

    Flexisel is a beautifully designed responsive carousel jQuery plugin for a display of seamless images.

     

    10. ImageloaderJS

    ImageloaderJS

    Website designers generally ignore the importance of preloading images. This jQuery plugin will preload all the images on the website, increasing the overall loading speed of the website on the browsers. Especially recommended for websites with image galleries.

     

    11. Responsive jQuery Lightbox Plugin : Magnific Popup

    Responsive jQuery Lightbox Plugin : Magnific Popup

    Magnific Popup is a responsive jQuery lightbox plugin that is focused on performance and providing best experience for user with any device.

     

    12. Tiny Circleslider

    Tiny Circleslider

    Tiny Circle slider is a circular slider/carousel. That was built to provide web developers with a cool but subtle alternative to all those standard carousels. Tiny Circle slider can blend in on any web page. It was built using the javascript jQuery library.

     

    13. jQuery Map Marker

    jQuery Map Marker

    This plugin makes it easy to put multiple markers on Map using Google Map API V3.Map Marker is very useful when you have a list of data & you want to show all of them on Map, too.

     

    14. Camera : jQuery Slideshow Plugin with Touch Support

    Camera : jQuery Slideshow Plugin with Touch Support

    A cool jQuery slideshow with diverse variation of transitions for your website.

     

    15. Responsive Touch-Friendly Audio Player

    Responsive Touch Audio jQuery script

    This user friendly responsive plugin will integrate a minimal audio player on your website for listening online music. Some of the features like being adaptive to browsers, showing the pre-loaded (buffered) audio and image-less CSS, have made it distinctive from other such kinds of plugins.

     

    16. Huge on Facebook

    Huge on Facebook

    This jQuery script is designed to highlight the links on websites that are actually generating conversation (on Facebook, at least). Like Google analytics, this plugin can be considered as Facebook analytics. The only difference this plugin is making is the display of analysis report to the general public rather than the administrator only.

     

    17. jQuery Spellchecker

    Spell Checker jQuery

    The jQuery spellchecker is a lightweight plugin that can be used to check the spelling of text within a form field or within a DOM tree. Can come handy with the content writers.

     

    18. Any List Scroller

    Any List Scroller

    Any List Scroller is the jQuery plugin to scroll any list, of any dimension, with any content.

     

    19. jQuery Stripe

    Stripe jQuery

    A jQuery plug-in to create a cool striped gallery object.

     

    20. jQuery Liquid Carousel Plugin

    jQuery Liquid Carousel plugin

    Liquid carousel is a jQuery plugin intended for liquid designs. Every time the container of the carousel gets re sized, the number of items in the list change to fit the new width.

    반응형
    반응형

    모바일웹에서 새 창 닫기

     

     

    function popClose(){
               window.open('', '_self', '');
               window.close();
            }

     

    반응형
    반응형

    Chart.JS - SIMPLY STUNNING  HTML5 JS Chart and Gauge Widgets

     

    http://chartjs.devexpress.com/

     

    Dynamic client side data visualization

    Whether you are creating traditional websites, sites that target mobile devices, or native apps built with HTML5 JavaScript and compiled with Apache Cordova (PhoneGap), ChartJS provides high-performance and elegant data visualization options for all your business intelligence needs.

     

     

     

     

     

     

     

    반응형
    반응형
    PhoneJS - HTML5 JavaScript Mobile Development Framework

     

    http://phonejs.devexpress.com/

     

    Create mobile apps with HTML5 and JavaScript for different screens and platforms

      

    HTML5 JavaScript framework for smartphones and tablets

    PhoneJS contains everything you'll need to create native client applications using HTML5 and JavaScript with a single codebase and deliver solutions that target today's most popular smartphones and tablet devices.

    With a touch-optimized user experience, natively rendered widgets, straightforward page navigation, view management, and data access layers, PhoneJS is a single page application (SPA) framework for your next iOS, Android and WindowsPhone application, ready for online publication or packaged as a store-ready native app using Apache Cordova (PhoneGap).

     

     

    Demos

    DX WorkoutQR Code 

    DX Work out

    A sample application that demonstrates the power of the PhoneJS framework and ChartJS data visualization widgets. DXWorkout uses local storage to store data and the PhoneGap API for its splash screen and to persist user data when leaving the application (incoming call, switch to another app, back to home screen, etc). Built with MVVM in mind, DXWorkout illustrates the separation of app logic from its UI. It’s iPhone 5 compatible and includes full source code with PhoneGap Build config.

    Run DemoView Sourcehttp://dxpr.es/10oXsNf
    Kitchen SinkQR Code

    Kitchen Sink

    PhoneJS ships with over 30 touch optimized HTML JS widgets that are automatically styled for each target platform. The Kitchen Sink demo illustrates the use of each widget and how you can use them to build store-ready applications for the App Store, Google Play or Microsoft Store.

    Run DemoView Sourcehttp://dxpr.es/14lqpt4
    Tip CalculatorQR Code

    Tip Calculator

    TipCalculator is a straightforward PhoneJS application, with a single view and view model. It’s been designed to help you learn the basics of the PhoneJS framework. Description

    Run Demo

     

     

     

    반응형
    반응형

    Pop Easy — Easy modal windows with jQuery

    pop easy

     

    반응형

    + Recent posts