Improve this Doc View Source $parse
- $parseProvider
- service in module ng
Overview
Converts AngularJS expression into a function.
var getter = $parse('user.name'); var setter = getter.assign; var context = {user:{name:'AngularJS'}}; var locals = {user:{name:'local'}}; expect(getter(context)).toEqual('AngularJS'); setter(context, 'newValue'); expect(context.user.name).toEqual('newValue'); expect(getter(context, locals)).toEqual('local');
Usage
$parse(expression);
Arguments
Param | Type | Details |
---|---|---|
expression | string | String expression to compile. |
Returns
function(context, locals) |
a function which represents the compiled expression:
|
© 2010–2018 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://code.angularjs.org/1.7.8/docs/api/ng/service/$parse