angular.directive.ng:eval

Work in Progress This page is currently being revised. It might be incomplete or contain inaccuracies.

Description

The ng:eval allows you to execute a binding which has side effects without displaying the result to the user.

Usage

<ANY ng:eval="expression">
   ...
</ANY>

Parameters

Example

<input name="obj.a" value="6" > * <input name="obj.b" value="2"> = {{obj.multiplied = obj.a * obj.b}} <br> <span ng:eval="obj.divide = obj.a / obj.b"></span> <span ng:eval="obj.updateCount = 1 + (obj.updateCount||0)"></span> <tt>obj.divide = {{obj.divide}}</tt><br/> <tt>obj.updateCount = {{obj.updateCount}}</tt> it('should check eval', function(){ expect(binding('obj.divide')).toBe('3'); expect(binding('obj.updateCount')).toBe('2'); input('obj.a').enter('12'); expect(binding('obj.divide')).toBe('6'); expect(binding('obj.updateCount')).toBe('3'); });