JSFiddle - React, Tailwind, and code Playground

simple angular model binding testing

by Trina Lu

HTML

<div ng-app="testApp">

  <div ng-controller="MainController">
    <input type="number" placeholder="price" ng-model="price">
    <input type="number" placeholder="num" ng-model="num">
    <br> {{price}} x {{num}} = {{total()}}
  </div>
</div>

JavaScript

(function() {
  var app = angular.module('testApp', []);
  app.controller('MainController', ['$scope', function($scope) {
    $scope.price = 10;
    $scope.num = 3;
    $scope.total = function() {
      return $scope.price * $scope.num;
    };
  }]);
}());