两个 .factory 错误 ( angularjs + ionic )

Two .factory error ( angularjs + ionic )

我有两个 .factory,每个都有一个数组,但是第二个 .factory 给我一个错误,就像不能有两个 .factory

请帮忙

谢谢

.factory('RawData', function() {
    // Might use a resource here that returns a JSON array

    // Some fake testing data   
    var rawData = [{
      "id": "1",
      "tipo": "evento",
      "titulo": "Esta es una noticia de dos líneas principal",
      "bg": "fondo-not.png",
      "bgdetail": "noti-detalle.png",
      "fec": "ABRIL, 14,  2:56 AM",
      "com": "Backpack from Très Bien. Made in collaboration with Haerfest. Nylon body with top zip closure. Leather bottom. Outer compartment with zip closure and leather trims. Adjustable shoulder straps in leather. Metal hardware. Lined with cotton. Inner compartments. Outer logo branding."
    }];

    return {
        all: function() {
            return rawData;
        },
        get: function(id) {         
            for (var i = 0; i < rawData.length; i++) {  

                if (parseInt(rawData[i].id) === parseInt(id)) {
                    return rawData[i];                                  
                }
            }           
            return null;
        }
    };
});

.factory('ServicioData', function() {
    // Might use a resource here that returns a JSON array

    // Some fake testing data   
    var servData = [{
      "id": "1",
      "logo": "logo1.png",
      "titulo": "Restaurante",    
      "com": "Nuestro Menú"
    }];

    return {
        all: function() {
            return servData;
        },
        get: function(id) {         
            for (var i = 0; i < servData.length; i++) { 

                if (parseInt(servData[i].id) === parseInt(id)) {
                    return servData[i];                                 
                }
            }           
            return null;
        }
    };
});

错误:

Uncaught Error: [$injector:modulerr] Failed to instantiate module starter due to: Error: [$injector:nomod] Module 'starter' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. http://errors.angularjs.org/1.3.13/$injector/nomod?p0=starter at REGEX_STRING_REGEXP (http://localhost/ionic/www/lib/ionic/js/ionic.bundle.js:8346:12) at http://localhost/ionic/www/lib/ionic/js/ionic.bundle.js:10050:17 at ensure (http://localhost/ionic/www/lib/ionic/js/ionic.bundle.js:9974:38) at module (http://localhost/ionic/www/lib/ionic/js/ionic.bundle.js:10048:14) at http://localhost/ionic/www/lib/ionic/js/ionic.bundle.js:12380:22 at forEach (http://localhost/ionic/www/lib/ionic/js/ionic.bundle.js:8606:20) at loadModules (http://localhost/ionic/www/lib/ionic/js/ionic.bundle.js:12364:5) at createInjector (http://localhost/ionic/www/lib/ionic/js/ionic.bundle.js:12290:11) at doBootstrap (http://localhost/ionic/www/lib/ionic/js/ionic.bundle.js:9728:20) at bootstrap (http://localhost/ionic/www/lib/ionic/js/ionic.bundle.js:9749:12) http://errors.angularjs.org/1.3.13/$injector/modulerr?p0=starter&p1=Error%3…2Flocalhost%2Fionic%2Fwww%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A9749%3A12)

删除;在第一个工厂结束后,您可以继续链接第二个工厂。

.factory('RawData', function() {
    // Might use a resource here that returns a JSON array

    // Some fake testing data   
    var rawData = [{
      "id": "1",
      "tipo": "evento",
      "titulo": "Esta es una noticia de dos líneas principal",
      "bg": "fondo-not.png",
      "bgdetail": "noti-detalle.png",
      "fec": "ABRIL, 14,  2:56 AM",
      "com": "Backpack from Très Bien. Made in collaboration with Haerfest. Nylon body with top zip closure. Leather bottom. Outer compartment with zip closure and leather trims. Adjustable shoulder straps in leather. Metal hardware. Lined with cotton. Inner compartments. Outer logo branding."
    }];

    return {
        all: function() {
            return rawData;
        },
        get: function(id) {         
            for (var i = 0; i < rawData.length; i++) {  

                if (parseInt(rawData[i].id) === parseInt(id)) {
                    return rawData[i];                                  
                }
            }           
            return null;
        }
    };
})

.factory('ServicioData', function() {
    // Might use a resource here that returns a JSON array

    // Some fake testing data   
    var servData = [{
      "id": "1",
      "logo": "logo1.png",
      "titulo": "Restaurante",    
      "com": "Nuestro Menú"
    }];

    return {
        all: function() {
            return servData;
        },
        get: function(id) {         
            for (var i = 0; i < servData.length; i++) { 

                if (parseInt(servData[i].id) === parseInt(id)) {
                    return servData[i];                                 
                }
            }           
            return null;
        }
    };
});