Create a Service structure

Objectives

  • Write a custom Service
  • Use the custom Service in Controller

Instructions

Let's write our own service to do some basic math.

Using the existing directory structure, we've got a controller that's trying to call a service that doesn't exist yet, named MathService. Create that service in js/app/services/MathService.js.

Our controller is trying to call MathService.sum() with an array of numbers, expecting it to return the sum of all those numbers. Create this method, then see if it displays the sum correctly!