我使用 NgxAdmin 开发了一个 Angular 8 应用程序并将其托管为 Azure Web 应用程序。它在 NbAuthModule 的帮助下使用 Azure AD Oauth2 身份验证。一切正常。现在我尝试在 Azure 存储帐户上托管相同的 SPA。我将新的回调 url 添加到 Azure 广告应用注册并更新了 NbOAuth2AuthStrategy.setup-method 中的 redirectUri。
当我调用静态应用程序 ( https://<projectname>.z6.web.core.windows.net
)的基本 url 时,它正确地重定向到https://<projectname>.z6.web.core.windows.net/auth/login?return=%2Fpages%2Fdashboard
. 我可以通过 Azure Ad 登录。然后 url 更改为https://<projectname>.z6.web.core.windows.net/auth/callback#access_token=eyJ0eXAiOiJKV1Q...
并且应该重定向到先前定义的 return-url /pages/dashboard
。但我得到的只是回调链接上的 404。
此外,如果我尝试https://<projectname>.z6.web.core.windows.net/auth/login
直接调用 eg ,它会返回 404(如果我对 Web 应用程序执行相同操作,则会显示登录组件)。
我究竟做错了什么?是否对我的 Angular 代码进行了其他更改以使路由在 Azure 存储帐户中运行?
我正在尝试使用 pyodbc 获取 mssql 表列名称,并收到一条错误消息
ProgrammingError: No results. Previous SQL was not a query.
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
class get_Fields:
def GET(self,r):
web.header('Access-Control-Allow-Origin', '*')
web.header('Access-Control-Allow-Credentials', 'true')
fields = []
datasetname = web.input().datasetName
tablename = web.input().tableName
cnxn = pyodbc.connect(connection_string)
cursor = cnxn.cursor()
query = "USE" + "[" +datasetname+ "]" + "SELECT COLUMN_NAME,* FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = " + "'"+ tablename + "'"
cursor.execute(query)
DF = DataFrame(cursor.fetchall())
columns = [column[0] for column in cursor.description]
return json.dumps(columns)
Run Code Online (Sandbox Code Playgroud)
如何解决这个问题?
我已经设置了angular2-google-map
angular2应用程序.
这是app.module.ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import { AgmCoreModule} from 'angular2-google-maps/core';
@NgModule({
imports: [ BrowserModule, AgmCoreModule.forRoot({apiKey: 'AIzaSyAe3ci9yavJcWt7MaJE8DusAuZo-QeRqkU'}) ],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ],
})
export class AppModule { }
Run Code Online (Sandbox Code Playgroud)
我用命令安装了angular2-google-maps,
npm install angular2-google-maps --save
Run Code Online (Sandbox Code Playgroud)
哪个成功安装.当我用npm start运行应用程序时,它显示错误说,
http:// localhost:3000/angular2-google-maps/core无法加载资源:服务器响应状态为404(未找到)
但我可以在node_modules中看到angular2-google-maps文件夹.问题是什么?
我是 angular2 的新手,并试图使用该位置找到坐标(纬度,经度)。
这是我的代码,
地理服务.ts
import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/toPromise';
@Injectable()
export class GeoService {
constructor(private http: Http) { }
getLocation(term: string) {
return this.http.get('http://maps.google.com/maps/api/geocode/json?address=' + term + 'CA&sensor=false').map
((response) => response.json());
}
// tslint:disable-next-line:eofline
}
Run Code Online (Sandbox Code Playgroud)
应用程序组件.html
<!DOCTYPE HTML>
<h1> {{title}} </h1>
<input type="text" [(ngModel)]="location" />
<button (click)="findLocation($event)">Find location</button>
<sebm-google-map
[latitude]="lat"
[longitude]="lng"
[zoom]="zoom"
[disableDefaultUI]="false"
[zoomControl]="false"
(mapClick)="mapClicked($event)">
<sebm-google-map-marker
*ngFor="let m of markers; let i = index"
(markerClick)="clickedMarker(m.label, i)"
[latitude]="m.lat"
[longitude]="m.lng" …
Run Code Online (Sandbox Code Playgroud) 我遇到了这个问题,我有一个聊天服务器需要与托管在 aws 中的 lambda 服务进行通信,但云前端会引发以下错误。
BODY: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>ERROR: The request could not be satisfied</TITLE>
</HEAD><BODY>
<H1>ERROR</H1>
<H2>The request could not be satisfied.</H2>
<HR noshade size="1px">
Bad request.
<BR clear="all">
<HR noshade size="1px">
<PRE>
Generated by cloudfront (CloudFront)
Request ID: h5kPdVnMXwh-P7e7mxQ5LL1gj9fAupp_MNAPxmxufI74W4WhE_MByw==
</PRE>
<ADDRESS>
</ADDRESS>
</BODY></HTML>
Run Code Online (Sandbox Code Playgroud)
这就是我的请求在应用程序中的方式。
const options = {
hostname: 'xxx.uat.com',
port : '443',
path: '/qa/addMessage',
method: 'POST'
};
const req = http.request(options, (res) => {
}
Run Code Online (Sandbox Code Playgroud)
聊天 server.js …
amazon-ec2 amazon-web-services amazon-cloudfront serverless-framework
Stackblitz证明是一种出色的角度工具。它提供了巨大的支持,可以从GitHub查看角度项目。
有没有一种方法可以直接从vscode发布angular应用程序?
我有一个集合,我插入不同类型的文档.我使用type参数来区分集合中的不同数据类型.当我插入文档时,我为每个文档创建了一个Id字段,但Cosmosdb有一个内置的id字段.
如何在一个查询中插入新文档并检索所创建文档的ID?
如何在javascript中按字母表对数组列表中的名称进行排序,我尝试使用此代码
const sample = [
{
name: "AddMain",
mesg: "test000"
},
{
name: "Ballside",
mesg: "test004545"
},
{
name: "TestMain",
mesg: "test00"
},
{
name: "ball",
mesg: "test004545"
},
{
name: "Main",
mesg: "test004545"
},
{
name: "alliswell",
mesg: "test004545"
}
]
sample.sort(sortBy('name', false, function(a){return a.toUpperCase()}));
Run Code Online (Sandbox Code Playgroud)
但它在这段代码中无法正常工作 sortBy 我正在使用 lodash。如果可能的话,在 lodash 中会很好
以下是我的Typescript代码,可从API下载文件
DownloadLM() {
var ID= sessionStorage.getItem("UserID");
return this.http.get(this.baseurl + 'api/DownloadFiles/DownloadLM/' + ID,
{
headers: {
'Content-Type': 'application/json'
},
responseType: 'arraybuffer'
}
)
.subscribe(respData => {
this.downLoad(respData, this.type);
}, error => {
});
}
downLoad(data: any, type: string) {
var blob = new Blob([data], { type: type.toString() });
var url = window.URL.createObjectURL(blob);
var pwa = window.open(url);
if (!pwa || pwa.closed || typeof pwa.closed == 'undefined') {
alert('Please disable your Pop-up blocker and try again.');
}
}
Run Code Online (Sandbox Code Playgroud)
下载Excel文件很好,但是它给我不需要的文件一个随机的名字,我要在下载时设置自己选择的文件名,
在哪里可以设置文件名?Blob的任何属性?
我似乎无法让我的删除请求工作.我已经完成了所有的get请求,但现在我仍然坚持删除,似乎无法绕过它.
console.log'd URL始终正确,删除请求通过Postman正常工作.
有什么想法吗?
HTML
<button class="button button3" (click)="delTicket()"><span class="fa fa-trash"></span></button>
Run Code Online (Sandbox Code Playgroud)
TS
delTicket(){
this.id = this.route.snapshot.params.id;
this.ticketService.deleteTicket(this.id);
}
Run Code Online (Sandbox Code Playgroud)
服务
deleteTicket(id): Observable<Ticket[]>{
console.log(this.apiUrl + id);
return this.http.delete<Ticket[]>(this.apiUrl + id);
}
Run Code Online (Sandbox Code Playgroud) angular ×6
azure ×3
typescript ×3
google-maps ×2
amazon-ec2 ×1
angular5 ×1
blob ×1
entity ×1
geocoding ×1
javascript ×1
lodash ×1
primary-key ×1
pyodbc ×1
python ×1
rxjs ×1
sql-server ×1