Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialjason chan
31,009 PointsThis is my first simple calculator program for angular js
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example - example-example68-production</title>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.min.js"></script>
</head>
<body ng-app="">
First Num<input type="number" ng-model="number1">
Second Num<input type="number" ng-model="number2">
<button ng-click="count = count + number1" ng-init="count=0">
Add
</button>
<button ng-click="count = count - number2" ng-init="count=0">
Subtract
</button>
<button ng-click="count = count * number2" ng-init="count=0">
multiply
</button>
<button ng-click="count = count / number2" ng-init="count=0">
divide
</button>
<button ng-click="count = 0" ng-init="count=0">
clear
</button>
<span>
count: {{count}}
</span>
</body>
</html>
app.js
it('should check ng-click', function() {
expect(element(by.binding('count')).getText()).toMatch('0');
element(by.css('button')).click();
expect(element(by.binding('count')).getText()).toMatch('1');
});