我正在尝试发出 PUT 请求,但出现以下错误:
Failed to load <localhost:8080/uaa/groups/dfsfaes8323df32>: Response for preflight does not have HTTP ok status.
Run Code Online (Sandbox Code Playgroud)
显然,当我发出 GET 和 POST 请求并在邮递员中工作时它有效,但它不适用于我的代码中的 PUT 请求。
这是我的要求:
let link = "https://ice.<mydomain>.com/uaadev/Groups/{groupId}";
link = link.replace("{groupId}", data);
const updLoad = {
displayName: this.groupInfoObjects.displayName,
description: this.groupInfoObjects.description,
zoneId : "uaa",
schemas: [
"urn:scim:schemas:core:1.0"
]
};
let Header = new Headers({
Authorization: `Bearer {token}`.replace("{token}", this.token),
"Content-Type": "application/json",
Accept: "application/json",
"if-Match":"*"
});
let Option = new RequestOptions({ headers: Header });
this.http.put(link, updLoad, Option).subscribe(
res => {
console.log(res);
console.log(res.status);
if …Run Code Online (Sandbox Code Playgroud) 单击按钮后,我需要将按钮颜色更改为红色(原色为红色),请帮助我单击按钮后如何更改颜色。
<td>
<button mat-icon-button color="primary">
<mat-icon>remove_circle</mat-icon>
</button>
</td>Run Code Online (Sandbox Code Playgroud)
有什么方法可以更新 angular 4+ 中创建的键值对映射的值。
说我有:
testMap: Map<number, string> = new Map<number, string>();
ngOnInit() {
this.testMap.set(1, "A");
this.testMap.set(2, "B");
this.testMap.set(3, "C");
this.testMap.set(4, "D");
this.testMap.set(5, "E");
}
changeValue(id){
//id is the one of the keys of the map whose value needs to be altered
//let say (id=3)
this.testMap.put(id,"ChangedValue"); //PUT is from java
}
Run Code Online (Sandbox Code Playgroud) 我在 angular 6 中将 OpenLayers 5 用于我的项目。我实现了它以显示地图并且它正在工作:-)。但是我不能让它显示任何标记,请帮帮我!!!显示此版本 OpenLayers 的示例...
import OlMap from 'ol/Map';
import OlXYZ from 'ol/source/XYZ';
import OlTileLayer from 'ol/layer/Tile';
import OlView from 'ol/View';
import Feature from 'ol/Feature';
import Point from 'ol/geom/Point';
import {fromLonLat} from 'ol/proj';
export class MyComponent implements OnInit {
map: OlMap;
source: OlXYZ;
layer: OlTileLayer;
view: OlView;
marker: Feature;
ngOnInit() {
this.marker = new Feature({
geometry: new Point([27.46164, 53.902257])
});
this.source = new OlXYZ({
url: 'http://tile.osm.org/{z}/{x}/{y}.png',
features: [this.marker]
});
this.layer = new OlTileLayer({
source: this.source
}); …Run Code Online (Sandbox Code Playgroud) 我有一个在 Chrome 中完美运行的 Angular 6.x 应用程序。问题是尝试在 IE 11 中运行它时,出现错误:
错误:无效的参数。在 DefaultDomRenderer2.prototype.setProperty...
已经在 StackOverflow 中尝试了我在没有帮助的情况下找到的所有答案。我在这里列出主题,所以你们不会尝试将它们作为答案:
在 head 标签中添加:
<meta http-equiv="X-UA-Compatible" content="IE=11">
Run Code Online (Sandbox Code Playgroud)感谢您的帮助。
internet-explorer polyfills internet-explorer-11 angular angular6
在子组件中,我有一个数据表,当我单击该行时,我将获取数据并将其保存在 中branchToDivision,我还有一个按钮,当我点击该按钮时,我可以发送branchToDivision到父组件。
子组件
@Output() messageEvent: EventEmitter<BranchDto> = new EventEmitter<BranchDto>();
branchToDivision: BranchDto;
onSelect(record: BranchDto) {
this.branchToDivision = new BranchDto();
this.branchToDivision = record;
console.log(this.branchToDivision);
console.log(this.branchToDivision.brancH_CODE);
}
acceptBranch() {
this.onSelect(this.branchToDivision);
this.messageEvent.emit(this.branchToDivision);
this.branchModalDivision.hide();
}
Run Code Online (Sandbox Code Playgroud)
父组件
branch: BranchDto;
getBranch(branch: BranchDto): void{
this.branch = branch;
console.log(this.branch);
console.log(this.branch.brancH_CODE);
}
Run Code Online (Sandbox Code Playgroud)
父 HTML
<branchModal #branchModal (messageEvent)="getBranch($event)" ></branchModal>
Run Code Online (Sandbox Code Playgroud)
我尝试记录分支属性但未定义,怎么了?任何想法都对我有帮助。
我在 angular 6 应用程序中遇到了一个问题。附加路线时,滚动条不会改变其位置。我希望它在附加路线时滚动到页面顶部。
http://localhost:4200/#/pending-transfer是初始路线。用户单击页面中的按钮后,路由将附加到http://localhost:4200/#/pending-transfer/2595/62. 我试过使用window.scrollTo(0,0)in ngOnInit(),但这没有用。
我有一个 angular 6 项目。我创建了一个拦截器来显示“加载”面板。但是由于这个加载面板,我出现了这个错误。ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'ngIf: false'. Current value: 'ngIf: true'我该如何解决这个问题?
我的拦截器
export class LoaderInterceptor implements HttpInterceptor {
constructor(private ch: CommonHelper) { }
intercept(request: HttpRequest < any >, next: HttpHandler): Observable < HttpEvent < any >> {
this.ch.showLoader();
return next.handle(request)
.pipe(
tap((event: HttpEvent<any>) => {
if (event instanceof HttpResponse) {
this.ch.hideLoader();
}
}, (error: any) => {
if (error instanceof HttpErrorResponse) {
this.ch.messageHelper.showErrorMessage('Error Occured');
}
this.ch.hideLoader();
})
);
}
} …Run Code Online (Sandbox Code Playgroud) 当用户使用 mat Datepicker 选择日期时,我想以 dd/MM/YYYY 格式显示日期,但是当我在 Datepicker 中使用 Datepipe 时,它在我们选择时不显示任何日期
<mat-form-field class="box">
<input matInput [matDatepicker]="picker" placeholder="Generate Date" maxlength="10px" [readonly]="isNew1"
[ngModel]="quotation?.generateDate | date: 'dd/MM/yy'"
(ngModelChange)="quotation.generateDate=$event" [ngModelOptions]="{standalone: true}">
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker [disabled]="isNew1" #picker></mat-datepicker>
</mat-form-field>
Run Code Online (Sandbox Code Playgroud) 我想知道是否可以在 SPA 上实施 Azure AD SSO,是否有人知道这方面的任何好的(逐步?)指南?
我需要的主要是后端代码实现,但我完整的分步指南将是完美的。
我知道微软在这个页面上有一些例子,但我不确定它们是否与 angular 6 兼容:
Azure Active Directory 代码示例(v1.0 端点)
所以有什么好的建议吗?
angular6 ×10
angular ×6
typescript ×2
angular5 ×1
angular7 ×1
cors ×1
dictionary ×1
eventemitter ×1
html ×1
javascript ×1
openlayers-5 ×1
polyfills ×1
preflight ×1
rest ×1
scrollto ×1