我使用的是 PrimeNG 版本 10.0.2
使用组件p-inputNumber,onInput当手动修改值时不会触发该事件。当我使用旋转按钮时它可以正常工作。
HTML:
<p-inputNumber
[(ngModel)]="currentPage"
[showButtons]="true"
buttonLayout="horizontal"
spinnerMode="horizontal"
[step]="1"
size="2"
incrementButtonIcon="pi pi-angle-right"
decrementButtonIcon="pi pi-angle-left"
[min]="1"
[max]="maxPages"
(onInput)="changePage()"
>
</p-inputNumber>
Run Code Online (Sandbox Code Playgroud)
组件代码:
export class MyComponent {
currentPage = 1;
maxPages = 100;
...
changePage() {
console.log(this.currentPage);
}
}
Run Code Online (Sandbox Code Playgroud) 我正在将项目中的 Angular 版本升级到 14。但是当我尝试运行单元测试时,我得到了相同的错误:
\n \xe2\x97\x8f Test suite failed to run\n\n Cannot find module '@angular/core/testing' from 'node_modules/jest-preset-angular/build/config/setup-jest.js'\n\n Require stack:\n node_modules/jest-preset-angular/build/config/setup-jest.js\n node_modules/jest-preset-angular/setup-jest.js\n setupJest.ts\nRun Code Online (Sandbox Code Playgroud)\n这是当前的笑话配置:
\n笑话配置.js
\n/** @type {import('@jest/types').Config.InitialOptions} */\nconst config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setupJest.ts'],\n testPathIgnorePatterns: [\n '<rootDir>/node_modules/',\n '<rootDir>/dist/'\n ],\n moduleNameMapper: {\n "lodash-es": "lodash",\n },\n globals: {\n 'ts-jest': {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.html$',\n diagnostics: {\n ignoreCodes: [151001]\n }\n }\n },\n restoreMocks: true,\n clearMocks: true\n}\n\nmodule.exports = config;\nRun Code Online (Sandbox Code Playgroud)\nsetupJest.ts
\nimport 'jest-preset-angular/setup-jest';\nRun Code Online (Sandbox Code Playgroud)\n 正如标题,我的 AngularJS 项目中有这段代码:
window.onbeforeunload = function (e) {
e.preventDefault();
if ($sessionStorage.toReload) {
return 'Are you sure?';
}
};
Run Code Online (Sandbox Code Playgroud)
如果开发人员工具窗口打开,它可以正常工作,但在正常执行期间却不能。Chrome 和 Firefox 中都会发生这种情况。
我该如何修复它?
有什么方法可以让这个 CSS 类在 Internet Explorer 11 中工作吗?
.inactive {
filter: contrast(0.5) sepia(100%) hue-rotate(116deg) brightness(1.2) saturate(0.28);
}
Run Code Online (Sandbox Code Playgroud)
我尝试使用 SVG 灰度滤镜,但它不起作用,也破坏了常用浏览器中的整个功能。“避免使用 IE11”,即使是最好的建议,在这种情况下也不是合适的解决方案
第一次使用 Firebase,所以我不知道发生了什么。我没有修改使用的配置ng add @angular/fire,所以我的配置AppModule是:
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AppRoutingModule,
provideFirebaseApp(() => initializeApp(environment.firebase)),
provideFirestore(() => getFirestore()),
provideAuth(() => getAuth()),
provideDatabase(() => getDatabase()),
provideFunctions(() => getFunctions()),
provideMessaging(() => getMessaging()),
provideRemoteConfig(() => getRemoteConfig()),
provideStorage(() => getStorage()),
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Run Code Online (Sandbox Code Playgroud)
在另一个模块中,使用延迟加载,我调用 method signInWithEmailAndPassword(auth, email, password),但在控制台中收到以下错误:
Either AngularFireModule has not been provided in your AppModule (this can be done manually or implictly using
provideFirebaseApp) or you're calling an …Run Code Online (Sandbox Code Playgroud) 我刚刚在我的计算机上安装了 Verdaccio。除了添加 proxy_相关信息之外,我没有更改配置文件中的任何内容:
http_proxy: http://proxy.ip:8080
https_proxy: https://proxy.ip:8080
no_proxy: localhost,127.0.0.1
Run Code Online (Sandbox Code Playgroud)
启动该过程后,我尝试从库项目工作区登录注册表
npm adduser --registry http://localhost:4873
Run Code Online (Sandbox Code Playgroud)
但我收到这个错误:
npm ERR! 503 Service Unavailable - POST http://localhost:4873/-/v1/login
Run Code Online (Sandbox Code Playgroud)
如果我尝试从浏览器访问http://localhost:4873/,我可以看到 Verdaccio 网页。
我究竟做错了什么?
我对这段代码有疑问:
function aFunction(){
....
var deferred = $q.defer();
debounce(function () {
deferred.resolve(service.subscribe0(data));
}, 350);
return deferred.promise;
}
Run Code Online (Sandbox Code Playgroud)
返回的承诺永远不会得到解决。Debounce 功能是第 3 方功能,从 NPM 进行了大量下载,因此我可以确定它可以工作。
难道是因为 return 语句“删除”了函数的作用域?我怎样才能避免这种情况并兑现承诺?