我试图使用AJAX来检索我想在用户端显示的推送通知的详细信息,但它还没有工作.
/*
*
* Push Notifications codelab
* Copyright 2015 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES …Run Code Online (Sandbox Code Playgroud) 我希望在 Javascript 函数中具有与“清除站点数据”相同的行为,因为我的 Angular 应用程序(升级 Angular 后)似乎在不清除站点数据的情况下行为不当,而且我不希望客户被迫自行清除站点数据。
如果不可能清理所有内容,是否至少有一种方法可以清理 1) localStorage 2) 所有 IndexedDB 数据库 3) Cookie 和 4) Web SQL
提前致谢
我正在使用自动完成功能,以便用户可以选择一个地址(或搜索并选择它)。
在同一页面上,用户可以添加地址。他们添加地址后,我想将地址添加到 mat-autocomplete 中。
目前我的问题是 mat-autocomplete 没有显示任何选项。为了进行故障排除,我设置了一个 div,它使用 *ngFor 来显示地址并且可以工作和更新。
// 组件(省略一些代码)
filteredAddresses_pickup;
constructor(public translate: TranslateService, private addressService:
AddressService, private route: ActivatedRoute) { }
ngOnInit() {
this.addresses = this.route.snapshot.data['addresses'];
this.filteredAddresses_pickup = Observable.create((observer: Observer<Address[]>) => {
observer.next(this.addresses);
this.addressService.addressesChanged.subscribe(
(addresses: Address[]) => {
observer.next(addresses);
this.addresses = addresses;
console.log(this.addresses);
});
this.pickupaddress.valueChanges.subscribe(value_entered => {
console.log(value_entered);
console.log(this._filterAddresses(value_entered));
observer.next(this._filterAddresses(value_entered));
});
});
}
Run Code Online (Sandbox Code Playgroud)
组件 HTML:
<mat-form-field class="full-width">
<input matInput placeholder="{{ 'mainapp.shipment.pickupaddress' | translate }}"
attr.aria-label="{{ 'mainapp.shipment.pickupaddress' | translate }}" [matAutocomplete]="auto"
[formControl]="pickupaddress"
>
<ng-template *ngIf="filteredAddresses_pickup | async; else …Run Code Online (Sandbox Code Playgroud) 我正在创建一个Chrome应用,我在应用中创建了一个Logout按钮.
如何重新启动/重置应用程序?(应重新启动background.js/background页面)