Lets say i want to reuse a function in angularjs that returns a specific value but i want to call it in other parts controllers of the app so i don't rewrite it in other places (dry) , where would i put that function in an angularjs app? Would i make a service of factory for this?
Say i have two controllers and in those two controllers i want to call function foo()
that returns a certain number when i pass a variable through it. Where would i put function foo()
in my angular structure?