Две заводские ошибки (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;
        }
    };
});

Ошибка:

Неперехваченная ошибка: [$ injector: modulerr] Не удалось создать экземпляр стартера модуля из-за: Ошибка: [$ injector: nomod] Модуль 'starter' недоступен! Вы либо неправильно написали имя модуля, либо забыли его загрузить. При регистрации модуля убедитесь, что вы указали зависимости в качестве второго аргумента. http://errors.angularjs.org/1.3.13/ $ injector / nomod? p0 = стартер в REGEX_STRING_REGEXP (http://localhost/ionic/www/lib/ionic/js/ionic.bundle.js:8346:12) по адресу http://localhost/ionic/www/lib/ionic/js/ionic.bundle.js:10050:17 при обеспечении (http://localhost/ionic/www/lib/ionic/js/ionic.bundle.js:9974:38) в модуле (http://localhost/ionic/www/lib/ionic/js/ionic.bundle.js:10048:14) по адресу 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) в loadModules (http://localhost/ionic/www/lib/ionic/js/ionic.bundle.js:12364:5) в createInjector (http://localhost/ionic/www/lib/ionic/js/ionic.bundle.js:12290:11) в doBootstrap (http://localhost/ionic/www/lib/ionic/js/ionic.bundle.js:9728:20) при начальной загрузке (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)


person user3810167    schedule 07.08.2015    source источник
comment
Покажите, где вы регистрируете стартовый модуль, т.е. angular.module("starter", [...])   -  person New Dev    schedule 08.08.2015


Ответы (1)


удалить ; после окончания первой фабрики, чтобы вы могли продолжить цепочку второй.

.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;
        }
    };
});
person GPicazo    schedule 07.08.2015