Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript angularjs注射器在移动浏览器中不工作_Javascript_Angularjs - Fatal编程技术网

Javascript angularjs注射器在移动浏览器中不工作

Javascript angularjs注射器在移动浏览器中不工作,javascript,angularjs,Javascript,Angularjs,我收到了[$injector:unpr]未知提供者:AccountProvider您以错误的方式注册了帐户服务 你应该写: controllers.factory('Account', ['$http', function($http) { return { Login: function(username, password) { $http.post('/api/login', {username:username, password:password}).

我收到了
[$injector:unpr]未知提供者:AccountProvider您以错误的方式注册了帐户服务

你应该写:

controllers.factory('Account', ['$http', function($http)
{
return {
    Login: function(username, password)
    {
       $http.post('/api/login', {username:username, password:password}).
        then(function(result){   });
    }
}
}]);

此问题与移动web视图有关,请更新移动web视图以解决此类错误。如果使用旧的移动视图,则肯定会出现此类错误


感谢

这使得应用程序在桌面浏览器上无法正常运行。我不得不移动文件,所以桌面浏览器仍然可以工作,但在移动设备上失败,同样的错误。你能通过以下方式提供服务吗:app.service('Account',[“$http”,function$http){this.Login=function(用户名,密码){$http.post('/api/login',{username:username,password:password}));同时请告诉我您编写的文件的顺序。Thankstill在手机上不起作用。order app.js->services.js->controllers.js->account.js->loginCtrl.js。也许下面的答案就是原因,我正在黑莓9320上测试。
controllers.factory('Account', ['$http', function($http)
{
return {
    Login: function(username, password)
    {
       $http.post('/api/login', {username:username, password:password}).
        then(function(result){   });
    }
}
}]);