小编The*_*ram的帖子

禁用相同的源策略Internet Explorer

Chrome允许我们禁用相同的原始策略,因此我们可以测试跨源请求.我想知道是否有可能在IE中做同样的事情

internet-explorer cors websecurity

36
推荐指数
2
解决办法
7万
查看次数

是否有可能使"HTML to speech"与"Text to speech"相同?

我有一个奇怪的要求,在我现有的应用程序Text2Speech中,我已经习惯AVSpeechSynthesizer了语音文本,但现在我的客户要求他想要语音HTML文件,因为他有很多HTML文件DB.

我的建议:

使用HTML解析并从HTML获取所有文本并使用Text2Speech的相同框架.

但客户端不希望这种类型的解析,他想要任何API直接提供HTML2Speech功能的框架.

任何建议或帮助将受到高度赞赏.

html text-to-speech ios

19
推荐指数
1
解决办法
753
查看次数

如何在 Jenkins 环境变量中为 Headless Chrome 配置 CHROME_BIN 路径

我正在研究基本的 Angular 项目,并且能够在我的 Windows 上使用无头 chrome 使用 karma 和 Jasmin 运行测试。但是JenkinsNo binary for ChromeHeadless browser on your platform这么说 ,所以问题是如何在Jenkins配置中配置ChromeHeadless。

错误日志

您的平台上没有 ChromeHeadless 浏览器的二进制文件。请设置 CHROME_BIN”环境变量。npm ERR!测试失败。

包.json

 "devDependencies": {
    "@angular-devkit/build-angular": "~0.6.8",
    "@angular/cli": "~6.0.8",
    "@angular/compiler-cli": "^6.1.0",
    "@angular/language-service": "^6.0.3",
    "@types/jasmine": "~2.8.6",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.2.1",
    "jasmine-core": "^2.9.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "^1.7.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage": "^1.1.2",
    "karma-coverage-istanbul-reporter": "~2.0.0",
    "karma-jasmine": "~1.1.1",
    "karma-jasmine-html-reporter": "^0.2.2",
    "karma-phantomjs-launcher": "^1.0.4",
    "karma-sonarqube-unit-reporter": "0.0.18",
    "protractor": "~5.3.0",
    "ts-node": "~5.0.1",
    "tslint": "~5.9.1",
    "typescript": "^2.9.2"
  }
Run Code Online (Sandbox Code Playgroud)

业力配置文件

// Karma configuration file, …
Run Code Online (Sandbox Code Playgroud)

jenkins jenkins-pipeline angular google-chrome-headless

11
推荐指数
1
解决办法
8819
查看次数

如何在离子3中停止缓存我的HTTP请求和响应

我想停止缓存我的API请求和响应哪个native-http插件存储其缓存及其创建我的应用程序的问题.

所有时间API工作正常,但当我从服务器收到404或401错误时,它会将其缓存在我的应用程序中,然后在所有时间后我将获得1状态的超时错误.

要解决此问题,我需要卸载应用程序并重新安装它将按预期工作.

任何想法如何停止缓存HTTP请求和响应?

或者如何解决1状态的超时问题?

我在我的请求标题中尝试过以下内容,但仍未成功.

self.httpPlugin.setHeader('*', 'authorization', 'Bearer ' + token);
self.httpPlugin.setHeader('*', 'Cache-control', 'no-cache');
self.httpPlugin.setHeader('*', 'Cache-control', 'no-store');
self.httpPlugin.setHeader('*', 'Expires', '0');
self.httpPlugin.setHeader('*', 'Pragma', 'no-cache');
Run Code Online (Sandbox Code Playgroud)

还在我的请求中添加了虚拟唯一参数,以便像下面那样发出我的API调用的唯一请求.

self.httpPlugin.setHeader('*', 'ExtraDate', new Date().toString());
Run Code Online (Sandbox Code Playgroud)

在Ionic 3中遇到过这种问题的人?

尝试了这个线程的建议,但没有运气.

为此问题建议任何解决方案.

**编辑:**

完整的请求代码:

/**
   * Get Search result from server.
   */
getCaseListBySearchText(searchText: string): Observable<any> {
    let self = this;

  return Observable.create(function(observer) {
    self.getToken().then(token => {
      console.log("Token : ", token);

      // let rand = Math.random();
      self.httpPlugin.setHeader("*", "authorization", "Bearer " + token);
      self.httpPlugin.setHeader("*", "Cache-control", "no-cache");
      self.httpPlugin.setHeader("*", "Cache-control", "no-store"); …
Run Code Online (Sandbox Code Playgroud)

ios nsurlsession ionic3 cordova-plugin-advanced-http

9
推荐指数
1
解决办法
1694
查看次数

Ionic 4 离子输入只允许数字,限制字母和特殊字符

我正在 ionic4 中创建一个应用程序,我有一个功能,用户可以输入唯一的整数 (0-9),所以我想限制任何其他字符,即字母、点等。
我试图限制使用以下指令

 @HostListener('input', ['$event']) onInputChange(event) {
    this.inputElement = this._el.nativeElement.getElementsByTagName('input')[0];
    const initalValue = this.inputElement.value;
    this.inputElement.value = initalValue.replace(/[^0-9]*/g, '');
    if (initalValue !== this.inputElement.value) {
       event.stopPropagation();
    }
}
Run Code Online (Sandbox Code Playgroud)

它正在正确更新 ngModel,但仍然在输入字段中可见无效字符。

我尝试了另一种选择,如下所示

html

<ion-input type="text" placeholder="Enter number"
        [(ngModel)]="userCount" 
        name="userCount" 
        (ionInput)="countChange($event)">
 </ion-input>
 Usercount: {{userCount}}
Run Code Online (Sandbox Code Playgroud)

打字稿

countChange(event) {
    event.target.value = event.target.value.replace(/[^0-9]*/g, '');
}
Run Code Online (Sandbox Code Playgroud)

其在 HTML 中的打印值正确无无效字符,但在输入中显示无效字符。

如果我在 input 中输入 5+,ngModel 中的值显示 5 但输入字段显示 5+

当我输入 5++ 然后再次输入 5 时,输入字段现在显示 55。

如何限制输入只接受整数值 [0-9]

typescript ionic-framework ionic4 angular7

9
推荐指数
1
解决办法
2万
查看次数

ng update 不检查或更新 @angular-devkit 包

我有角度 CLI 7.3.0。根据这里的发布描述,本次发布还涉及发布@angular-devkit/build-angular 0.13.0

正如你在下面的屏幕截图中看到的,我有 @angular-devkit/build-angular、@angular-devkit/architect、@angular-devkit/build-optimizer、@angular-devkit/build-webpack 版本均为 0.10.2 。

然后我执行了 操作ng update,CLI 告诉我一切正常。为什么?难道它不应该告诉我需要将前面提到的所有软件包更新到 0.13.0 吗?

或者更好的是,当我执行操作时,这些软件包不应该自动更新吗ng update @angular/cli?这是我更新到 CLI 7.3.0 时执行的命令,但 @angular-devkit 软件包没有更新 在此输入图像描述

angular-cli angular

8
推荐指数
2
解决办法
2万
查看次数

失败:模块“ DynamicTestModule”导入了意外的指令“ ContactDetailsComponent”。请添加@NgModule批注

我创建了一个新组件并进行了ng测试,但由于以下错误而失败

失败:模块“ DynamicTestModule”导入了意外的指令“ ContactDetailsComponent”。请添加一个@NgModule批注。

import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { AdditionalContactDetailsComponent } from './additional-contact-details.component';
import { EdlInputModule, EdlIconModule, EdlMessagesModule } from '@fedex/ddt';
import { ReactiveFormsModule, FormBuilder, FormsModule } from '@angular/forms';
import { ContactDetailsComponent } from '../contact-details/contact-details.component';
import { HttpClientModule } from '@angular/common/http';
import { HttpClientTestingModule } from '@angular/common/http/testing';

fdescribe('AdditionalContactDetailsComponent', () => {
  let component: AdditionalContactDetailsComponent;
  let fixture: ComponentFixture<AdditionalContactDetailsComponent>;

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      imports: [EdlInputModule,
        ReactiveFormsModule,
        FormsModule,
        EdlIconModule,
        EdlMessagesModule,
        ContactDetailsComponent,
        HttpClientModule,
        HttpClientTestingModule],
      declarations: [AdditionalContactDetailsComponent],
      providers: [FormBuilder]
    }) …
Run Code Online (Sandbox Code Playgroud)

typescript karma-jasmine angular

8
推荐指数
1
解决办法
3959
查看次数

在构建'找不到名称'排除'后出现lodash错误

我正在跟踪lodash错误

node_modules/@types/lodash/common/object.d.ts(1689,12)中的错误:错误TS2304:找不到名称“排除”。node_modules/@types/lodash/common/object.d.ts(1766,12):错误TS2304:找不到名称“排除”。node_modules/@types/lodash/common/object.d.ts(1842,34):错误TS2304:找不到名称“排除”。

typescript lodash angular

8
推荐指数
4
解决办法
8309
查看次数

JavaScript 如何检测耳机是否插入或移除?

JavaScript 中有没有什么事件,我可以在浏览器中收听,通过它我们可以知道是否插入或移除了耳机?

我假设如果我们能够在 JavaScript 中迭代音频输出设备,是否有可能,我们可以扣除音频输出设备数量的变化?

javascript browser headphones

6
推荐指数
1
解决办法
2871
查看次数

使用 npm 安装 Angular-cli 时出错

当我尝试使用 npm 安装 Angular-cli 时,代码 ETIMEDOUT 出现错误

我尝试删除代理(代理和 HTTP 代理),尝试在管理员模式下运行 cmd,将路径更改为 nodejs 目标

npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! network request to https://registry.npmjs.org/@angular%2fcli failed, reason: connect ETIMEDOUT 104.16.22.35:443
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' …
Run Code Online (Sandbox Code Playgroud)

command-line-interface failed-installation npm angular

5
推荐指数
1
解决办法
5569
查看次数