Services: Factory

AngularJS - HTML enhanced for web apps!

Services: Provider »

Called via a Function

Boston's Baseball Team: {{vm.returnSox()}}

Direct call to a variable

Boston's Hockey Team: {{vm.bostonHockey}}

Using the factory to compute a number directly: vm.returnMath(8)

Squaring 8 in the Factory: {{vm.returnMath(8)}}

Dropdown Choice uses Factory to determine which player to display

Select a Team:
{{vm.returnBestPlayer(vm.teamDropDownChoice.name)}} plays for the {{vm.teamDropDownChoice.name}} in {{vm.teamDropDownChoice.city}}

Direct Factory Access

vm.DirectAccessTest.returnText() = "{{vm.DirectAccessTest.returnText()}} " (no can do :))

Factory needs to accessed via the controller

The other team in Chicago is the {{vm.returnWhiteSox()}}

Factory var access

Tampa's Hockey Team is the {{vm.returnTampaLightning()}} (needs a function to return the var)