Join Chris Converse for an in-depth discussion in this video Calculate wattage usage for incandescent bulbs, part of Creating a Calculation Tool with AngularJS 1.
- So now we're ready to start making our first calculations.…And we're going to create all of our calculations…and brand new variables…for the cost and the wattage inside of the custom function…that we created earlier.…Now to illustrate the way…that we're going to be making these calculations,…we're going to be starting from the amount of lumens…that the user wants the lightbulb to produce.…So in this case, we'll start with 600.…So 600 lumens.…We're going to take that value,…and we're going to multiply it by our conversion rate.…So for the incandescent bulb at the top,…we're going to multiply this by 0.0625,…and then all of the other conversion rates…that we added earlier.…
And then once we get these values,…which will be in the form of a decimal,…we're going to make sure that each value…has one single decimal place,…and based on the values you put in for the lumens,…you could get an infinitely repeating decimal.…So in this case, we can see…that the value for the halogen conversion is 27,…it's on a whole number,…
Using these lessons, and the free exercise files, you can build any kind of calculation tool for your clients, from shipping cost to mortgage payment calculators.
- Creating the HTML page structure
- Hooking in CSS and AngularJS
- Adding form elements
- Styling the layout with CSS
- Adjusting the layout for small (mobile) screens
- Defining the AngularJS application and controller
- Calculating usage and cost