JSFiddle - React, Tailwind, and code Playground
by yonet3d
HTML
<div ng-app="demoApp">
<div ng-controller="MainController as main">
<input type="text" ng-model="newMeaning" placeholder="Meaning of Life"/>
<button ng-click="changeMeaning(newMeaning)">Change</button>
<br/>
<p>The answer is, {{meaning}}</p>
</div>
</div>
CSS
</style> <!-- Ugly Hack due to jsFiddle issue: http://goo.gl/BUfGZ --> <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.0.4/css/bootstrap-combined.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.js"></script> <style>
JavaScript
var app = angular.module("demoApp", []);
app.controller("MainController", function($scope){
//initial value
$scope.meaning = 42;
$scope.changeMeaning = function(num){
var num = num || 42;
$scope.meaning = Math.floor(Math.random() * num);
};
})