Executes the expression
on the current scope returning the result. Any exceptions in the
expression are propagated (uncaught). This is useful when evaluating engular expressions.
var scope = angular.scope(); scope.a = 1; scope.b = 2; expect(scope.$eval('a+b')).toEqual(3); expect(scope.$eval(function(scope){ return scope.a + scope.b; })).toEqual(3);
angular.scope.$eval([expression]);
expression(optional) – {(string|function())} –
An angular expression to be executed.
string
: execute using the rules as defined in expression.function(scope)
: execute the function with the current scope
parameter.{*}
– The result of evaluating the expression.