©
Dokumen ini menggunakan Manual laman web PHP Cina Lepaskan
Converts Angular expression into a function.
var getter = $parse('user.name');
var setter = getter.assign;
var context = {user:{name:'angular'}};
var locals = {user:{name:'local'}};
expect(getter(context)).toEqual('angular');
setter(context, 'newValue');
expect(context.user.名称).toEqual('newValue');
expect(getter(context, locals)).toEqual('local');
$parse(expression);
参数 | 类型 | 详述 |
---|---|---|
expression | string |
String expression to compile. |
function(context, locals) |
a function which represents the compiled expression:
|