Skip to content

Instantly share code, notes, and snippets.

Created December 18, 2015 21:42

Revisions

  1. @invalid-email-address Anonymous created this gist Dec 18, 2015.
    49 changes: 49 additions & 0 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,49 @@
    <!DOCTYPE html>
    <html>
    <head>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.min.js"></script>

    <meta charset="utf-8">
    <title>JS Bin</title>
    </head>
    <body ng-app="app">

    <div ng-controller="ctrl">
    Score: {{ score.points }}
    <button ng-click="increment()">Increment</button>
    </div>

    <script id="jsbin-javascript">
    angular
    .module('app', [])
    .value('randomScore', function() {
    return Math.ceil(Math.random() * 10);
    })
    .factory('score', function(randomScore) {
    return {points: randomScore()};
    })
    .controller('ctrl', function($scope, score) {
    $scope.score = score;
    $scope.increment = function() {
    $scope.score.points++;
    };
    });
    </script>



    <script id="jsbin-source-javascript" type="text/javascript">angular
    .module('app', [])
    .value('randomScore', function() {
    return Math.ceil(Math.random() * 10);
    })
    .factory('score', function(randomScore) {
    return {points: randomScore()};
    })
    .controller('ctrl', function($scope, score) {
    $scope.score = score;
    $scope.increment = function() {
    $scope.score.points++;
    };
    });</script></body>
    </html>
    14 changes: 14 additions & 0 deletions jsbin.xizazu.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    angular
    .module('app', [])
    .value('randomScore', function() {
    return Math.ceil(Math.random() * 10);
    })
    .factory('score', function(randomScore) {
    return {points: randomScore()};
    })
    .controller('ctrl', function($scope, score) {
    $scope.score = score;
    $scope.increment = function() {
    $scope.score.points++;
    };
    });