0
我试图写角的JS模块把我的服务(文件:utils的/ productos.js),然后加载它作为我模块塔斯的依赖关系(塔斯/ ventas.js),但如何把服务放在angularjs上?
我得到下一个错误:
Error: [$injector:nomod] Module 'utils.producto' 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.10/$injector/nomod?p0=utils.producto angular.js:63:11
Error: [$injector:modulerr] Failed to instantiate module webui due to:
[$injector:modulerr] Failed to instantiate module utils.producto due to:
[$injector:nomod] Module 'utils.producto' 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.10/$injector/nomod?p0=utils.producto
minErr/<@http://localhost/cat-dog/web/app/js/angular.js:63:12
module/<@http://localhost/cat-dog/web/app/js/angular.js:1764:1
[email protected]://localhost/cat-dog/web/app/js/angular.js:1688:38
[email protected]://localhost/cat-dog/web/app/js/angular.js:1762:1
loadModules/<@http://localhost/cat-dog/web/app/js/angular.js:4094:22
[email protected]://localhost/cat-dog/web/app/js/angular.js:323:11
[email protected]://localhost/cat-dog/web/app/js/angular.js:4078:5
loadModules/<@http://localhost/cat-dog/web/app/js/angular.js:4095:40
[email protected]://localhost/cat-dog/web/app/js/angular.js:323:11
lo
app.js
var app = angular.module('webui', ['ngRoute', 'utils.producto', 'ventas']);
main.html中
<script type="text/javascript" src="ventas/ventas.js"></script>
<script type="text/javascript" src="js/app.js"></script>
<script type="text/javascript" src="utils/productos.js"></script>
个
塔斯/ ventas.js
angular.module('ventas', ['ngRoute', 'utils.producto'])
.config(['$routeProvider', function ($routeProvider) {
$routeProvider.when('/ventas', {
templateUrl: 'ventas/ventas.html',
controller: 'VentasCtrl'
});
}])
utils的/ producto.js
angular.module('utils.producto').factory("buscadorProductos", buscadorProductos).factory("autocompProductos", autocompProductos);
function buscadorProductos($http) {
..
是。这是麻烦。非常感谢。我失去了理智。 – user92083452 2015-03-30 22:05:31
@ user92083452是的,这就是它..接受答案,如果它确实帮助你,谢谢:) – 2015-03-30 22:06:28
是的,我必须等待9分钟来做到这一点。我在等待。 – user92083452 2015-03-30 22:17:20