Accessing a function from a another function in services.js (solved)


I’m very new to Ionic, but I think that it looks great and expect to use it in the future! My question is probably very newbie like, but I’m trying to access a function from a another function in services.js, but when I call TestTest from my GUI I get a “Error: Test is not defined” error (from Firebug). The following code is just a simplification of my code, but shows the problem (I hope):

angular.module(‘’, [])

.factory(‘Test’, function() {

var t = ‘123’;

return {
all: function() {
return t;

.factory(‘TestTest’, function() {

var tests = [
{ id: 0, titel: Test.all() },
{ id: 0, titel: Test.all() }

return {
all: function() {
return tests;
get: function(id) {
return tests[id];

I absolutely need to be able to access other objects data from functions to get my program to work, and I hope very much anyone would help to solve this issue. Thanks.

Ok, I found the answer myself:


.factory(‘TestTest’, function() { …


.factory(‘TestTest’, function(Test) { …

Do the job.