Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular.min.js"></script>
  <meta charset="utf-8">
  <title>Evaluate logic</title>
  <script>
   angular.module('example', [])
   .run(function ($rootScope, $parse) {
     var ops = {
       add: function (a, b) { return a + b; },
       mul: function (a, b) { return a * b; }
     };
     var logic = 'mul(add(a, 1), b)';
     var data = {
       a: 10,
       b: 4
     };
     
    $rootScope.result = $parse(logic)(ops, data);
   });
   </script>
</head>
<body ng-app="example">
  <p>result {{ result }}</p>
</body>
</html>
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
bahmutovpro
0viewers