当在Angular应用中运行ng serve并成功编译时,我开始在浏览器控制台中收到以下错误。
AppComponent_Host.ngfactory.js? [sm]:1 ERROR Error: Arguments array must have arguments.
at injectArgs (core.js:1412)
at core.js:1491
at _callFactory (core.js:8438)
at _createProviderInstance (core.js:8396)
at resolveNgModuleDep (core.js:8371)
at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get
(core.js:9064)
at resolveDep (core.js:9429)
at createClass (core.js:9309)
at createDirectiveInstance (core.js:9186)
at createViewNodes (core.js:10406)
Run Code Online (Sandbox Code Playgroud)
据我从Main.ts得知 platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.log(err));
我已删除节点模块文件夹并重新安装,但由于错误给出的解释不足,我遇到了麻烦。另外,我对Angular还是有些陌生。
任何帮助将不胜感激。
我跑步ng serve --aot并出现以下错误
ERROR in : Error: Internal error: unknown identifier []
at Object.importExpr$$1 [as importExpr] (C:\Users\kg\Documents\ang2\ad\UI\node_modules\@angular\compiler\bundles\compiler.umd.js:21731:27)
at C:\Users\kg\Documents\ang2\ad\UI\node_modules\@angular\compiler\bundles\compiler.umd.js:9988:37
at Array.map (<anonymous>)
at InjectableCompiler.depsArray (C:\Users\kg\Documents\ang2\ad\UI\node_modules\@angular\compiler\bundles\compiler.umd.js:9954:25)
at InjectableCompiler.factoryFor (C:\Users\kg\Documents\ang2\ad\UI\node_modules\@angular\compiler\bundles\compiler.umd.js:10018:36)
at InjectableCompiler.injectableDef …Run Code Online (Sandbox Code Playgroud) 我试图在Angular 6应用程序中使用以下方法以编程方式从Azure Active Directory获取访问令牌。
let body1 = new FormData()
body1.append("resource", environment.config.clientId)
body1.append("grant_type", "client_credentials")
body1.append("client_id", environment.config.clientId)
body1.append("client_secret", "*****")
return this._http.post("https://login.microsoftonline.com/" + environment.config.tenant + "/oauth2/token", body1)
Run Code Online (Sandbox Code Playgroud)
我能够通过Postman中的此URL检索访问令牌,但是在通过我的应用程序调用它时被CORS阻止。错误如下。
Failed to load https://login.microsoftonline.com/*****/oauth2/token:
Response to preflight request doesn't pass access control check: No 'Access-
Control-Allow-Origin' header is present on the requested resource. Origin
'http://localhost:4200' is therefore not allowed access.
Run Code Online (Sandbox Code Playgroud)
因此,如何在Azure Active Directory上为所有域启用CORS?
我正在尝试获取一个项目的所有分支
https://dev.azure.com/$organization/$project/_apis/tfvc/branches?&api-
version=5.0
Run Code Online (Sandbox Code Playgroud)
我在其他有效的查询中使用凭据、组织和项目变量。请求格式基于此处的示例
https://docs.microsoft.com/en-us/rest/api/azure/devops/tfvc/branches/get?view=azure-devops-rest-5.0
我得到的回应是
count value
----- -----
0 {}
Run Code Online (Sandbox Code Playgroud)
当存储库中有许多分支时。
我应该在某处指定存储库吗?或者还有什么?谢谢!