Professional Documents
Culture Documents
Angularjs Cheat Sheet: by Via
Angularjs Cheat Sheet: by Via
Filters
Services
amount | currency[:symbol]
$anchorScroll
name {string}
$cacheFactory
compiledHtml = $compile(html)(scope)
$controller
$cookieStore
$document
$exceptionHandler (exception[, cause])
data | json
Convert a JavaScript object into JSON
string.
array | limitTo:limit
Creates a new array containing only a
specified number of elements in an array.
$filter (name)
$http [(options)]
priority {integer}
Specifies order multiple directives apply on
single DOM element (higher = first)
terminal {true}
Current priority will be last set of directives
to execute
scope {true | object}
True - create child scope. Undefi ned|false use parent scope. {} - isolate scope (with
$injector
$locale
$location
string | lowercase
$httpBackend
$interpolate(text[, mustHaveExpression])
text | linky 1
$log
$parse(expression)
$provide
$q
array | orderBy:predicate[:reverse]
Predicate is function(*)|string|Array. Reverse
is boolean
string | uppercase
Converts string to uppercase.
You can inject the $filter service and do
$rootElement
$rootScope
$route
$routeParams
$filter('filterName')(value[, :optionalParam][,
$routeProvider
$sanitize(html)
$transclude)
$templateCache
exp -->
$window
By ProLoser
Sponsored by Readability-Score.com
cheatography.com/proloser/
www.DeanSofer.com
Page 1 of 4.
https://readability-score.com
Directives (cont)
Directives (cont)
template {string}
ng-controller="plaintext"
ng-bind-html="expression"
ng-disabled="boolean"
ng-href="plaintext{{string}}"
appending
ng-include="string"|<ng-include src="string"
transclude {boolean}
Compiles contents on parent (pre-isolate)
scope. Usually used with ngTransclude &
templates.
compile function(tElement, tAttrs, fn
transclude(function(scope, cloneLinkingFn) )
ng-init="expression"
<input ng-pattern="/regex/" ng-minlength
ng-maxlength ng-required
<input ng-list="delimiter|regex">
value="plaintext" ng-false-
value="plaintext">
ng-model="expression"
ng-mousedown="expression"
ng-mouseenter="expression"
ng-mouseleave="expression"
ng-mousemove="expression"
ng-mouseover="expression"
Directives
ng-app="plaintext"
ng-bind[-html-unsafe]="expression"
template="string{{expression}}string{{expression}}"
ng-change="expression"
ng-checked="boolean"
ng-class[-even|-odd]="string|object"
ng-[dbl]click="expression"
ng-cloak="boolean"
ng-mouseup="expression"
<select ng-multiple>
ng-non-bindable
ng-bind-
onload="expression" autoscroll="expression">
returns link()
loading.
service(name, constructor)
value(name, object)
name
Name of the module.
Holds the list of modules which the injector
will load before the current module is
loaded.
http://docs.angularjs.org/api/angular.Module
ng-src="string"
ng-style="string|object"
ng-submit="expression"
ng-switch="expression"|<ng-switch
on="expression">
ng-switch-when="plaintext"
ng-switch-default
ng-transclude templates
ng-view|<ng-view>
By ProLoser
Sponsored by Readability-Score.com
cheatography.com/proloser/
www.DeanSofer.com
Page 2 of 4.
https://readability-score.com
$root or $rootScope
$evalAsync(expression)
angular.equals(o1, o2)
equivalent.
$new(isolate)
Creates a new child scope
$id
$on(name, listener)
angular.extend(dst, src)
Extends the destination object dst by
copying all of the properties from the src
object(s) to dst.
angular.forEach(obj, iterator[, context])
Invokes the iterator function once for each
item in obj collection, which can be either an
object or an array.
angular.fromJson(json)
too.
The following directives create child scopes:
child scopes
$destroy()
Removes the current scope (and all of its
children) from the parent scope
$digest()
Process all of the watchers of the current
scope and its children. Since watchers can
change models, they will continue firing until
scope: ng-click="$parent.showPage=true"
Global Functions
angular.bind(self, fn, args)
RECURSIVE CODE
$emit(name, args)
angular.bootstrap(element[, modules])
angular application.
$eval(expression)
angular.injector(modules)
angular.copy(source[, destination])
angular.isArray(value)
Determines if a reference is an Array.
angular.isDate(value)
Determines if a value is a date.
angular.isDefined(value)
Determines if a reference is defined.
angular.isElement(value)
Determines if a reference is a DOM element
(or wrapped jQuery element).
angular.isFunction(value)
Determines if a reference is a Function.
By ProLoser
Sponsored by Readability-Score.com
cheatography.com/proloser/
www.DeanSofer.com
Page 3 of 4.
https://readability-score.com
FormController
angular.isNumber(value)
$pristine
$q.all([array of promises])
$dirty
$valid
$q. defer()
$invalid
$error
http://docs.angularjs.org/api/ng.directive:form.For
angular.isUndefined(value)
Determines if a reference is undefined.
angular.lowercase(string)
NgModelController
$render()
angular.mock
Namespace from 'angular-mocks.js' which
method.
$setValidity(validationErrorKey, isValid)
$setViewValue(value)
$viewValue
mixed
$modelValu
mixed
e
$parsers
$formatters
$q.when( value)
Wraps an object that might be a value or a
(3rd party) then-able promise into a $q
promise
Deferred.resolve( value)
Resolves the derived promise with the value
Deferred.reject(reason )
Rejects the derived promise with the reason
Deferred.promise
Promise object associated with this deferred
Promise.then(successCallback,
errorCallback)
http://docs.angularjs.org/api/ng.$q
angular.toJson(obj[, pretty])
string.
$q.reject( reason )
Creates a promise that is resolved as
mController
$error
object
$pristine
boolean
$dirty
boolean
$valid
boolean
$invalid
boolean
http://docs.angularjs.org/api/ng.directive:ngModel.
NgModelController
By ProLoser
Sponsored by Readability-Score.com
cheatography.com/proloser/
www.DeanSofer.com
Page 4 of 4.
https://readability-score.com