2015-08-31 64 views
3

我正在开发一个MEAN应用程序。我的角文件夹结构如下: enter image description here为什么我无法从名为'users'的文件夹加载文件?

,并获得我的应用程序出现以下错误: enter image description here

,但是当我重新命名“用户”文件夹到别的,像“用户”,它的工作原理: enter image description here enter image description here

这是为什么?

编辑:

app.js为requeseted:

var mainModuleName = 'mean'; 

var mainModule = angular.module(mainModuleName, ['ngRoute', 'example', 'users']); 

mainModule.config(['$locationProvider', function($locationProvider) { 
    $locationProvider.hashPrefix('!'); 
}]); 

if (window.location.hash === '#_=_') window.location.hash - '#!'; 

angular.element(document).ready(function() { 
    angular.bootstrap(document, [mainModuleName]); 
}); 
+0

你可以发布你的app.js文件吗? – hassansin

+0

将其添加为EDIT – Idefixx

回答

0

Bwah!傻我。

我有一个方法,我的API,它是在以下几点:

http://localhost:3000/users

所以不是服务文件,它达到了API,并且也是为什么猫鼬在控制台有引发错误图片。

0

我想你错过了你的第一个案例angular.module第二个参数。你应该有

angular.module('users',[]).factory('auth',[auth]); 

因为你没有括号,你不是真正创建的用户一个新实例,这就是错误的来源。

此链接可能会帮助 https://docs.angularjs.org/api/ng/function/angular.module

+0

,它实际上会与我已定义的模块相冲突。虽然我不认为这是角色的问题 – Idefixx

相关问题