问题描述
这问题是一个跟进<一个href=\"http://stackoverflow.com/questions/36376469/definition-for-gapi-in-an-angular-controller?noredirect=1#comment60385004_36376469\">Definition在一个角控制器GAPI?昨日发布。
This question is a follow up to Definition for gapi in an Angular controller? which is posted yesterday.
用户pinoyyid向我指出他的混帐回购协议ngDrive( https://github.com/pinoyyid/ngDrive)
User pinoyyid pointed me to his git repo ngDrive (https://github.com/pinoyyid/ngDrive)
我是通过不干开始工作,并遇到了一个错误说'ngDrive没有定义
在我的控制台。
I was working through the quit start and ran into an error saying 'ngDrive' is not defined
in my console.
这是code导致此错误
This was the code that cause this error
angular.module('ngm.ngDrive')
.provider('OauthService', ngDrive.Config)
.config(function (OauthServiceProvider) {
OauthServiceProvider.setScopes('https://www.googleapis.com/auth/drive.file');
OauthServiceProvider.setClientID('2231299-2bvf1.apps.googleusercontent.com');
OauthServiceProvider.setTokenRefreshPolicy(ngDrive.TokenRefreshPolicy.ON_DEMAND);
OauthServiceProvider.setNoAccessTokenPolicy(999); // 0 = fail, > 0 = retry after x
});
具体的 ngDrive.Config
注入到服务时,我没有问题,我的 app.js
文件,如下
I had no issue when injecting the service into my app.js
file as shown below
angular
.module('App', [
'ngAnimate',
'ngCookies',
'ngResource',
'ngRoute',
'ngSanitize',
'ngTouch',
'ui.sortable',
'firebase',
'angular-toArrayFilter',
'ngm.ngDrive'
])
我也放置脚本标记为库指定的:
I have also placed the script tag for the library as specified:
<!-- build:js({.tmp,app}) scripts/scripts.js -->
<script src="bower_components/ngDrive/build/module.js"></script>
<script src="scripts/app.js"></script>
<script src="scripts/controllers/login_controller.js"></script>
<script src="scripts/controllers/view_resources_ctrl.js"></script>
<!-- endbuild -->
我不太清楚我在做什么错在这里。我没有看到,我可能不小心跳过了指南中的任何东西。
I'm not quite sure what I'm doing wrong here. I don't see anything in the guide that I might have accidentally skipped.
感谢您的时间。
推荐答案
的'ngDrive没有定义
是造成 module.js
无法加载。如果你看一下网络选项卡,你会看到一个404。
The 'ngDrive' is not defined
is caused by module.js
failing to load. If you look at the network tab, you'll see a 404.
此外,还有在文档中的一个bug, setNoAccessTokenPolicy
不再是一个功能,所以你应该删除该行。版本0.1.10补丁的文档。
Also, there is a bug in the documentation, setNoAccessTokenPolicy
is no longer a feature, so you should delete that line. Version 0.1.10 fixes the documentation.
这篇关于ngDrive没有定义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!