我正在为我的 angular 4 项目使用带有 https 而不是 https 的服务工作者。但我收到此错误: Service Worker 注册失败:DOMException:无法注册 ServiceWorker:获取脚本时发生 SSL 证书错误。
这是我的 service-worker.js
module.exports = {
navigateFallback: '/index.html',
stripPrefix: 'dist',
root: 'dist/',
staticFileGlobs: [
'dist/index.html',
'dist/**.js',
'dist/**.css',
'dist/assets/image/**.*',
'dist/assets/image/client-home-carousel/**.*',
]
};
Run Code Online (Sandbox Code Playgroud)
angular-cli.json 中的一个:
"assets": [
"assets",
"favicon.ico",
"service-worker.js"
],
Run Code Online (Sandbox Code Playgroud) [ts]无法找到模块'@ angular/core'.
[ts]无法找到模块'@ angular/router'.
import {Component, ElementRef, Input,Output,EventEmitter,Inject, OnInit,ViewChild} from '@angular/core';
import {KendoGridComponent} from '../grid/grid.component'
import { Router} from '@angular/router';
Run Code Online (Sandbox Code Playgroud)
{
"name": "SPORTS",
"version": "1.0.0",
"description": "SPORTS player - v0.2.37.1",
"engines": {
"node": "7.10.1"
},
"license": "ISC",
"dependencies": {
"@angular/animations": "^5.2.2",
"@angular/common": "^5.2.2",
"@angular/compiler": "^5.2.2",
"@angular/compiler-cli": "^5.2.2",
"@angular/core": "^5.2.2",
"@angular/forms": "^5.2.2",
"@angular/http": "^5.2.2",
"@angular/platform-browser": "^5.2.2",
"@angular/platform-browser-dynamic": "^5.2.2",
"@angular/platform-server": "^5.2.2",
"@angular/router": "^5.2.2",
"@angular/upgrade": "2.0.0",
"@ng-idle/core": "2.0.0-beta.2",
"@ng-idle/keepalive": "2.0.0-beta.2",
"@types/jquery": "^3.2.10", …Run Code Online (Sandbox Code Playgroud) 尝试使用 angular2-json-schema-form & build in prod 时出现此错误
装饰器不支持“DemoModule”函数调用的模板编译期间出错,但调用了“JsonSchemaFormModule”。我发现错误来自:
@NgModule({
declarations: [ AceEditorDirective, DemoComponent, DemoRootComponent ],
imports: [
BrowserModule, BrowserAnimationsModule, FlexLayoutModule, FormsModule,
HttpClientModule, MatButtonModule, MatCardModule, MatCheckboxModule,
MatIconModule, MatMenuModule, MatSelectModule, MatToolbarModule,
RouterModule.forRoot(routes),
NoFrameworkModule, MaterialDesignFrameworkModule,
Bootstrap3FrameworkModule, Bootstrap4FrameworkModule,
JsonSchemaFormModule.forRoot( // the source of the Error
NoFrameworkModule,
MaterialDesignFrameworkModule,
Bootstrap3FrameworkModule,
Bootstrap4FrameworkModule
)
],
bootstrap: [ DemoRootComponent ]
})
Run Code Online (Sandbox Code Playgroud)
在库的源代码中,他们使用如下内容:
export class JsonSchemaFormModule {
static forRoot(...frameworks): ModuleWithProviders {
const loadFrameworks = frameworks.length ?
frameworks.map(framework => framework.forRoot().providers[0]) :
[{ provide: Framework, useClass: NoFramework, multi: true }];
return { …Run Code Online (Sandbox Code Playgroud) javascript typescript angular angular6-json-schema-form ajsf
如何在Angular中使用Google GeoChart?我想在geoChart中注入角度数据,例如Javascript中的这些示例https://developers.google.com/chart/interactive/docs/gallery/geochart?hl=it#Regions
function drawRegionsMap() {
var data = google.visualization.arrayToDataTable([
['Country', 'Popularity'],
['Germany', 200],
['United States', 300],
['Brazil', 400],
['Canada', 500],
['France', 600],
['RU', 700]
]);
var options = {};
var chart = new google.visualization.GeoChart(document.getElementById('regions_div'));
chart.draw(data, options);
}
Run Code Online (Sandbox Code Playgroud)
一些忠告?
我想提供带有ion-select 的选择选项。我在第一个位置手动添加了全选选项,当我全选视图未更新时。如何更新视图?
<ion-select multiple="true">
<ion-option (ionSelect)="allClicked()">select all</ion-option>
<ion-option *ngFor="let item of students ; let i = index" [selected]="item.checked" [value]="item">{{item.studentName}}</ion-option>
</ion-select>
Run Code Online (Sandbox Code Playgroud)
.ts
allClicked(){
if(this.isAll){
console.log(this.isAll)
this.isAll = false;
for (let temp of this.students) {
temp.checked = false;
}
}else{
this.isAll = true;
for (let temp of this.students) {
temp.checked = true;
}
}
console.log("all select event ");
}
Run Code Online (Sandbox Code Playgroud) $ avdmanager create avd -n test -k "system-images;android-24;google_apis;x86"
Run Code Online (Sandbox Code Playgroud)
错误:所选包的无效--tag默认值.
如何解决这个错误?
使用 Ionic DateTime 分两步选择日期和时间:我想使用Ionic DateTime选择日期和时间。问题是pickerFormat="DD MMMM YYYY HH:mm"的选择器变得复杂且太窄,所以我想先选择日期,然后选择时间。关于如何这样做的任何想法?
我正在尝试使用离子存储中的令牌从服务器获取数据。我遇到的问题是,获取令牌承诺不能按时检索令牌。因此,每当我重新加载或重新打开该应用程序时,有时都会返回未经授权的错误。
仪表板service.ts
authUrl = "https://sampleapi.herokuapp.com"
authHeaders;
getToken() {
this.storage.get('token').then((token) => {
console.log('Bearer ' + token);
this.authHeaders = {
headers: new HttpHeaders({
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + token
})
}
});
}
getInfo(): Observable<Info> {
return this.http.get<Info>(this.authUrl + '/api/users/info', this.authHeaders).pipe(
catchError(this.handleError)
);
}
Run Code Online (Sandbox Code Playgroud)
仪表板
ionViewDidLoad() {
this._dashboardService.getToken();
this._dashboardService.getInfo().subscribe(
info => {
console.log('USER INFO: ' + info);
this.info = info
},
error => {
console.log('INFO ERROR: ' + error);
}
);
}
Run Code Online (Sandbox Code Playgroud) {
"id":1,
"name":"Jack",
"date":"01-06-2017"
},
{
"id":2,
"name":"Allen",
"date":"07-08-2017"
},
{
"id":3,
"name":"Annie",
"date":"22-11-2017"
},
Run Code Online (Sandbox Code Playgroud)
我想基于“开始”和“结束日期”过滤此存储在“成员”数组中的JSON,例如:
let startDate;
let endDate;
let selectedMembers = this.members.filter(m => m.date > startDate && m.date < endDate);
Run Code Online (Sandbox Code Playgroud)
像这样
我正在尝试将角度更新为最新版本.
我更新了global @ angular/cli
npm install -g @angular/cli
Run Code Online (Sandbox Code Playgroud)
然后,当我尝试更新local @ angular/cli时,ng update @angular/cli我收到此错误:
Error: Unexpected end of JSON input
Unexpected end of JSON input
Run Code Online (Sandbox Code Playgroud)
这是我的package.json
{
"name": "apimap",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^5.2.11",
"@angular/cdk": "^5.2.5",
"@angular/common": "^5.2.11",
"@angular/compiler": "^5.2.11",
"@angular/core": "^5.2.11",
"@angular/flex-layout": "^2.0.0-rc.1",
"@angular/forms": "^5.2.11",
"@angular/http": "^5.2.11",
"@angular/material": "^5.2.5",
"@angular/platform-browser": "^5.2.11",
"@angular/platform-browser-dynamic": "^5.2.11", …Run Code Online (Sandbox Code Playgroud)