Created
August 4, 2015 00:37
-
-
Save luisangelma/130cc27f0112327ac094 to your computer and use it in GitHub Desktop.
Angular Project Refreshner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html ng-app="mainApp"> | |
| <head> | |
| <title>Angular Site</title> | |
| <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script> | |
| </head> | |
| <body> | |
| <section ng-controller="sumController"> | |
| <h2> {{ sumValue }} (Added Value) </h2> | |
| <input type="text" ng-model="numOne"> | |
| <input type="text" ng-model="numTwo"> | |
| <button ng-click="add()">Add Values</button> | |
| </section> | |
| <section ng-controller="multController"> | |
| <h2> {{ multValue }} (Multiplied Value) </h2> | |
| <input type="text" ng-model="numOne"> | |
| <input type="text" ng-model="numTwo"> | |
| <button ng-click="mult()">Multiply Values</button> | |
| </section> | |
| </body> | |
| <script type="text/javascript" src="app.js"></script> | |
| <script type="text/javascript"> | |
| var app = angular.module('mainApp', []); | |
| app.controller('sumController', function($scope){ | |
| $scope.sumValue = 0; | |
| $scope.add = function() { | |
| $scope.sumValue = parseInt($scope.numOne) + parseInt($scope.numTwo); | |
| }; | |
| }); | |
| app.controller('multController', function($scope){ | |
| $scope.multValue = 0; | |
| $scope.mult = function() { | |
| $scope.multValue = parseInt($scope.numOne) * parseInt($scope.numTwo); | |
| }; | |
| }); | |
| </script> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment