2

Click here to load reader

AngularJS Cheatsheet [1/2] - Avarteq Cheatsheet version 1.0.0 (AngularJS 1.4.7) Need an AngularJS app developed? Hire us! avarteq.de AngularJS Cheatsheet [2/2] Title Print Created

  • Upload
    vunhu

  • View
    212

  • Download
    0

Embed Size (px)

Citation preview

Page 1: AngularJS Cheatsheet [1/2] - Avarteq Cheatsheet version 1.0.0 (AngularJS 1.4.7) Need an AngularJS app developed? Hire us! avarteq.de AngularJS Cheatsheet [2/2] Title Print Created

SCOPE EXTENSION

.controller() De�nes a new controller

.directive() De�nes a new directive

.factory() De�nes a new factory

.filter() De�nes a new �lter

.service() De�nes a new service

.provider() De�nes a new provider

.value() De�nes a new value

.const() De�nes a new const value

DIRECTIVE OPTIONS

scope:falsy Use parent scope (default)true Create child scope{...} Create isolated scope

@ Bind DOM attribute= Required bind from parent

scope=? Optional parent binding=* Shallow parent binding

restrict: (default: A, E)A Use attribute name

(<div directive>)

E Use element name(<directive>)

C Use class name(<div class=”directive”>)

controller Controller classreplace Replace HTML elementtransclude Extract the contents of

the element where the directive appears and make it available to the directive.

link Register DOM listeners

template Template HTML as astring

templateUrl Load template fromspeci�ed URL

templateNamespaceString representing the document type used by the markup in the template. (HTML, SVG, Math).

BUILT-IN DIRECTIVES

ng-app=”moduleName”Add rootScope

ng-controller=”controllerName”Add scope

ng-hide|show=”bool”Hide or show an element

ng-model=”obj”Bind view to a model

ng-repeat=”obj”Repeat an array

ng-viewPrint a template

ng-bindBind variable to a HTML tag as content

ng-cloakPrevent template from being displayed untilthe application has loaded

ng-FILTERS

currency Format number as a currencydate Format as a date with a requested format

filter Select a subset from an array

json Convert JavaScript objects to a JSON string

limitTo Get a speci�ed number of elements

lowercase Convert a string to lowercase

uppercase Convert a string to uppercase

number Format output as a number

orderBy Order output by expression

AngularJS Cheatsheet version 1.0.0 (AngularJS 1.4.7) Need an AngularJS app developed? Hire us! avarteq.de

AngularJS Cheatsheet [1/2]

GLOBAL FUNCTIONS

angular.bind(self, fn, args)

angular.bootstrap(element, [modules])Bootstrap the Angular application manually

angular.copy(source, [destination])Create a deep copy of source

angular.element(element)Wrap a raw DOM element or HTML string in ajQuery element

angular.equal(obj1, obj2)Check if two objects are equal

angular.fromJson(json)Deserialize a JSON string

Bind function to (other) context

angular.isArray(value)Check if reference is an Array

angular.isDate(value)Check if reference is a Date

angular.isDefined(value)Check if reference is de�ned

angular.isNumber(value)Check if reference is a Number

angular.toJson(obj, [pretty])Serialize input into a JSON string

angular.versionProvide information about AngularJS version

Page 2: AngularJS Cheatsheet [1/2] - Avarteq Cheatsheet version 1.0.0 (AngularJS 1.4.7) Need an AngularJS app developed? Hire us! avarteq.de AngularJS Cheatsheet [2/2] Title Print Created

SERVICES

$anchorScroll

$animate.on(event, container, callback)DOM animation

$animateCssTrigger CSS-based animation

$cacheFactoryConstruct Cache objects

$controllerInstantiate a controller

$documentAngular wrapper for window.document

$exceptionHandlerHandle UncaughtException

$filterFormat data

$httpMake HTTP requests

$httpBackendDelegates to XMLHttpRequest object or JSONP

$httpParamSerializer

$httpParamSerializerJQLike

$interpolate

Converts objects to strings

Alternative $http param serializer

Compiles a string with markup into an interpolation function

$intervalExecute a function every interval

$localeProvides localization rules

$anchorScrollProviderDisable automated scrolling

$animateProviderSynchronously performs DOM animation

$compileProviderSynchronously performs DOM animation

$controllerProviderRegister a new controller

$filterProviderRegister a new �lter

$httpProviderChange the default behavior of the $http service

$interpolateProviderCon�gure the interpolation markup

$locationProviderCon�gure how your application is handling the deeplinking paths

$logProviderCon�gure how the application logs messages

$parseProviderUsed for con�guring the default behavior of the $parse service

$rootScopeProviderCon�guration for the $rootScope service

$sceDelegateProviderCon�guration for the $rootScope service

$sceProviderCon�guration for the $sce service

PROVIDERS

$locationProvides interface to URL manipulation

$logService for logging

$parseConverts Angular expression into a function

$qRun functions asynchronously

$rootElementRoot element for Angular application

$rootScopeGlobal variable store

$sceProvides strict contextual escaping

$sceDelegateUsed by $sce

$templateCacheCaches template �les

$templateRequestRuns security checks and downloads template

$timeoutAngular wrapper for window.setTimeout

$windowReference to browser window object

$xhrFactoryCreate XMLHttpRequest objects

AngularJS Cheatsheet version 1.0.0 (AngularJS 1.4.7) Need an AngularJS app developed? Hire us! avarteq.de

AngularJS Cheatsheet [2/2]