这个问题是昨天发布的Definition for gapi in an Angular controller?的后续内容。
用户pinoyyid将我指向他的git repo ngDrive(https://github.com/pinoyyid/ngDrive)
我正在完成退出操作并在我的控制台中遇到错误'ngDrive' is not defined
。
这是导致此错误的代码
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
文件时没有问题,如下所示
angular
.module('App', [
'ngAnimate',
'ngCookies',
'ngResource',
'ngRoute',
'ngSanitize',
'ngTouch',
'ui.sortable',
'firebase',
'angular-toArrayFilter',
'ngm.ngDrive'
])
我还按照指定放置了库的脚本标记:
<!-- 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 -->
我不太确定我在这里做错了什么。我没有在指南中看到任何我可能不小心跳过的内容。
感谢您的时间。
答案 0 :(得分:0)
我在app.js之前做了bower install ngDrive --save
,包括<script src="../bower_components/ngDrive/build/module.js"></script>
(我的index.js在app文件夹中),注入ngm.ngDrive
,复制粘贴.provider('OauthService', ngDrive.Config)
。然后我加入了配置,
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);
没有人抱怨ngDrive.Config
。但我确实遇到了错误:
我试过但无法重现您的错误。
答案 1 :(得分:0)
Sub cf_months()
Dim m As Long, cnf As String
With Worksheets("Sheet1")
With .Range("A1")
.FormatConditions.Delete
For m = 12 To 1 Step -1
cnf = StrConv(Format(DateSerial(2016, m, 1), "mmm"), vbUnicode)
cnf = Join(Split(cnf, vbNullChar), Chr(92))
cnf = Chr(91) & Chr(61) & m & Chr(93) & Chr(92) & Left(cnf, Len(cnf) - 1) & Chr(59) & Chr(59) & Chr(59)
.FormatConditions.Add Type:=xlExpression, Formula1:=Chr(61) & .Address(0, 0) & Chr(61) & m
.FormatConditions(.FormatConditions.Count).NumberFormat = cnf
Debug.Print cnf
Next m
End With
End With
End Sub
是由'ngDrive' is not defined
无法加载引起的。如果您查看网络标签,则会看到404。
此外,文档中存在错误,module.js
不再是一项功能,因此您应删除该行。版本0.1.10修复了文档。