Two .factory error ( angularjs + ionic ) -
i have 2 .factory array each, throws me error second .factory , not have 2 .factory
any please
thank
.factory('rawdata', function() { // might use resource here returns json array // 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 très bien. made in collaboration haerfest. nylon body top zip closure. leather bottom. outer compartment zip closure , leather trims. adjustable shoulder straps in leather. metal hardware. lined cotton. inner compartments. outer logo branding." }]; return { all: function() { return rawdata; }, get: function(id) { (var = 0; < rawdata.length; i++) { if (parseint(rawdata[i].id) === parseint(id)) { return rawdata[i]; } } return null; } }; }); .factory('serviciodata', function() { // might use resource here returns json array // fake testing data var servdata = [{ "id": "1", "logo": "logo1.png", "titulo": "restaurante", "com": "nuestro menú" }]; return { all: function() { return servdata; }, get: function(id) { (var = 0; < servdata.length; i++) { if (parseint(servdata[i].id) === parseint(id)) { return servdata[i]; } } return null; } }; });
error:
uncaught error: [$injector:modulerr] failed instantiate module starter due to: error: [$injector:nomod] module 'starter' not available! either misspelled module name or forgot load it. if registering module ensure specify dependencies second argument. http://errors.angularjs.org/1.3.13/$injector/nomod?p0=starter @ 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 @ ensure (http://localhost/ionic/www/lib/ionic/js/ionic.bundle.js:9974:38) @ module (http://localhost/ionic/www/lib/ionic/js/ionic.bundle.js:10048:14) @ http://localhost/ionic/www/lib/ionic/js/ionic.bundle.js:12380:22 @ 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) @ 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)
remove ; after end of first factory can continue chaining second one.
.factory('rawdata', function() { // might use resource here returns json array // 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 très bien. made in collaboration haerfest. nylon body top zip closure. leather bottom. outer compartment zip closure , leather trims. adjustable shoulder straps in leather. metal hardware. lined cotton. inner compartments. outer logo branding." }]; return { all: function() { return rawdata; }, get: function(id) { (var = 0; < rawdata.length; i++) { if (parseint(rawdata[i].id) === parseint(id)) { return rawdata[i]; } } return null; } }; }) .factory('serviciodata', function() { // might use resource here returns json array // fake testing data var servdata = [{ "id": "1", "logo": "logo1.png", "titulo": "restaurante", "com": "nuestro menú" }]; return { all: function() { return servdata; }, get: function(id) { (var = 0; < servdata.length; i++) { if (parseint(servdata[i].id) === parseint(id)) { return servdata[i]; } } return null; } }; });
Comments
Post a Comment