Angularjs Cheatsheet
Angularjs Cheatsheet
Angularjs Cheatsheet
Filters
Services (cont)
amount | currency[:symbol]
$httpBackend
$injector
$interpolate(text[, mustHaveExpression])
$location
$log
$q
$resource(url[, paramDefaults][, actions])
$rootElement
$route
$routeProvider
$sanitize(html)
$templateCache
is boolean
string | uppercase
Converts string to uppercase.
You can inject the $filter service and do
$filter('filterName')(value[, :optionalParam][,
:optionalParam]) in use it in your javascript.
$cacheFactory
compiledHtml = $compile(html)(scope)
name {string}
$anchorScroll
$transclude)
Services
$provide
$parse(expression)
array | orderBy:predicate[:reverse]
$routeParams
string | lowercase
$locale
$rootScope
text | linky
terminal {true}
Current priority will be last set of directives
to execute
templateUrl {string}
Same as template but the template is
loaded from the specified URL
replace {boolean}
true: template replaces element instead of
appending
transclude {boolean}
Compiles contents on parent (pre-isolate)
scope. Usually used with ngTransclude &
$controller
templates.
$cookieStore
$document
$exceptionHandler (exception[, cause])
$filter (name)
$http [(options)]
Cheatographer
Dates
Sponsored by ReadabilityScore.com
ProLoser
cheatography.com/proloser/
https://readabilityscore.com
www.DeanSofer.com
Directives (cont)
Module (cont)
ng-
filter(name, filterFactory)
transclude(function(scope, cloneLinkingFn) )
mouse[down|enter|leave|move|over|up]="e
returns link()
xpression"
provider(name, providerType)
<select ng-multiple>
ng-non-bindable
Directives
ng-app="plaintext"
<option ng-selected="boolean">
ng-bind[-html-unsafe]="expression"
run(initializationFn)
ng-src="string"
loading.
service(name, constructor)
value(name, object)
name
Name of the module.
requires
Holds the list of modules which the injector
will load before the current module is loaded.
ng-bind-
ng-style="string|object"
template="string{{expression}}string{{expressi
ng-submit="expression"
on}}"
ng-switch="expression"|<ng-switch
ng-change="expression"
on="expression">
$root or $rootScope
ng-checked="boolean"
ng-switch-when="plaintext"
ng-class[-even|-odd] ="string|object"
ng-switch-default
ng-[dbl]click="expression"
ng-transclude templates
ng-cloak="boolean"
ng-view|< ng-view>
ng-controller="plaintext"
ng-bind-html="expression"
ng-disabled ="boolean"
http://docs.angularjs.org/api/angular.Module
Module
config(configFn)
Use this method to register work which
needs to be performed on module loading.
child scopes
$destroy()
Removes the current scope (and all of its
children) from the parent scope
constant(name, object)
Because the constant are fixed, they get
applied before other provide methods.
controller(name, constructor)
directive(name, directiveFactory)
factory(name, providerFunction)
Cheatographer
Dates
Sponsored by ReadabilityScore.com
ProLoser
cheatography.com/proloser/
https://readabilityscore.com
www.DeanSofer.com
Global Functions
$digest()
angular.isDefined(value)
angular.bootstrap(element[, modules
])
Use this function to manually start up
angular application.
angular.copy(source[, destina
tion])
Creates a deep copy of source, which
should be an object or an array.
angular.element(element)
Wraps a raw DOM element or HTML string
as a jQuery element.
angular.equals(o1, o2)
Determines if two objects or two values are
equivalent.
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
object or an array.
angular.fromJson(json)
too.
angular.identity()
angular.injector(modules)
Creates an injector function that can be
used for retrieving services as well as for
dependency injection.
angular.isArray(value)
Determines if a reference is an Array.
angular.isDate(value)
Determines if a value is a date.
Cheatographer
Dates
Sponsored by ReadabilityScore.com
ProLoser
cheatography.com/proloser/
https://readabilityscore.com
www.DeanSofer.com
FormController
$pristine
$q.all([array of promises])
Creates a Deferred object which represents
$dirty
$valid
$q. defer()
$invalid
$error
http://docs.angularjs.org/api/ng.directive:form.For
$q.reject( reason )
Creates a promise that is resolved as
mController
$setValidity(validationErrorKey, isValid)
$setViewValue(value)
$viewValue
mixed
$modelValu
mixed
e
$parsers
$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
$error
object
$pristine
boolean
$dirty
boolean
$valid
boolean
$invalid
boolean
http://docs.angularjs.org/api/ng.directive:ngModel.
NgModelController
Cheatographer
Dates
Sponsored by ReadabilityScore.com
ProLoser
cheatography.com/proloser/
https://readabilityscore.com
www.DeanSofer.com