angular6

Angular 6: Cannot read property 'runOutsideAngular' of undefined

久未见 提交于 2020-01-14 14:08:05
问题 I have created nav-bar using cli through this command ng g @angular/material:material-nav --name=version-nav and imported in my component as <app-version-nav></app-version-nav> and got this error any helpful suggestion would be highly appreciated 回答1: You can change target to es5 in tsconfig.js { "compileOnSave": false, "compilerOptions": { "baseUrl": "./", "outDir": "./dist/out-tsc", "sourceMap": true, "declaration": false, "module": "es2015", "moduleResolution": "node",

Angular 6 - rxjs pipe not working on valueChanges

半腔热情 提交于 2020-01-14 10:33:17
问题 I have a reactive form, with a text input. For ease of access in my typescript, I declared: get parentId(): FormControl { return this.addForm.get("parentId") as FormControl; } This part works, the control is properly accessed. Now in my ngOnInit if I do this: this.parentId.valueChanges.subscribe(() => console.log("Changed")); The console log is executed at every character changed in the input, as expected. But if I do this: this.parentId.valueChanges.pipe(tap(() => console.log("Changed")));

Angular 6 | Server side rendering: issue 'window not defined'

对着背影说爱祢 提交于 2020-01-14 06:26:08
问题 I have updated my application from angular version 5 to latest. Here's detail: Angular CLI: 6.2.1 Node: 8.12.0 OS: win32 x64 Angular: 6.1.6 Also I am using this: ng-toolkit-universal to achieve server side rendering. I am able to build application using command " npm run build:prod " , but facing following issue while running command: "n pm run server ": Can anyone please help or suggest some soution for the same. Thanks in advance! 回答1: Assuming you are done SSR with angular universal. Put

angular 6 ERROR ReferenceError: “process is not defined” with elasticsearch js

亡梦爱人 提交于 2020-01-13 18:07:41
问题 Before everything, I read: question 1 regarding process is not defined question 2 regarding process is not defined angular 5 question browser build info And none of the presented info helped. I'm using Angular 6 and I want to send query to elasticsearch, using elasticsearch js. I installed elasticsearch, elastic types and elastic browser like so: npm install elasticsearch npm install @types/elasticsearch npm install elasticsearch-browser I tried installing with --save, with --save-dev and

Angular 6 ngFor list of tables grouped by key

99封情书 提交于 2020-01-13 14:31:31
问题 My Angular 6 app needs to displays a list of tables, where a table is a group of chemical analyses of elements of its composition. Lets say I have a metal alloy A . I perform different compound analyses on it to find its chemical composition: Fe: 0.001%, Cu: 0.042%, etc. Here is my data source, which is only a typescript file with mocks import { Certificate } from './certificate'; export const CERTIFICATES: Certificate[] = [ { serie: '1050 AJ', ident: 'Fe', moy_certified: 0.297 }, { serie:

Argument of type 'IconDefinition' is not assignable to parameter of type 'IconDefinitionOrPack'

回眸只為那壹抹淺笑 提交于 2020-01-13 11:33:51
问题 I'm using Angular 6 angular-starter and fontawesome, followed here on how to install fa to ng. In my .ts looks like this: import { library, dom } from '@fortawesome/fontawesome-svg-core'; import { faInstagram } from '@fortawesome/free-brands-svg-icons/faInstagram'; import { faLink } from '@fortawesome/free-solid-svg-icons/faLink'; public ngOnInit() { library.add(faInstagram); library.add(faLink); dom.watch(); } Then in .html: <fa-icon [icon]="['fab', 'instagram']"></fa-icon> It works

Argument of type 'IconDefinition' is not assignable to parameter of type 'IconDefinitionOrPack'

让人想犯罪 __ 提交于 2020-01-13 11:32:46
问题 I'm using Angular 6 angular-starter and fontawesome, followed here on how to install fa to ng. In my .ts looks like this: import { library, dom } from '@fortawesome/fontawesome-svg-core'; import { faInstagram } from '@fortawesome/free-brands-svg-icons/faInstagram'; import { faLink } from '@fortawesome/free-solid-svg-icons/faLink'; public ngOnInit() { library.add(faInstagram); library.add(faLink); dom.watch(); } Then in .html: <fa-icon [icon]="['fab', 'instagram']"></fa-icon> It works

Module not found: Error: Can't resolve 'crypto' in '/opt/lampp/htdocs/angular-testing-app/node_modules/jwa'

吃可爱长大的小学妹 提交于 2020-01-13 11:08:09
问题 I will install jsonwebtoken module in my angular6 project npm i jsonwebtoken . The jsonwebtoken module Dependencies jwa installed, But that index.js file crypto require error Can't resolve 'crypto' , But i already install crypto module. Please help and clear the issue. My error: ERROR in ./node_modules/jwa/index.js Module not found: Error: Can't resolve 'crypto' in '/opt/lampp/htdocs/angular-testing-app/node_modules/jwa' ERROR in ./node_modules/jws/lib/sign-stream.js Module not found: Error:

Why mat-error not get displayed inside mat-form field in angular material 6 withcustom global validators

喜你入骨 提交于 2020-01-13 08:42:29
问题 i am using angular material 6 ,i have a vaidation inside mat-form-field mat-error is not displayed , when move after mat-form-field to the mat-error which is displaying properly. Not Working code: <mat-form-field> <input matInput type="time" formControlName="ToTime"/> <mat-error *ngIf="DaterForm.get('ToTime').hasError('InValidToTime')">FromTime Should be less than ToTime if choose a same date</mat-error> </mat-form-field> Working Fine: <input matInput type="time" formControlName="ToTime"/> <

How to make Angular application read cookies at start up

戏子无情 提交于 2020-01-11 13:09:08
问题 I have an Angular application which on start up should read Cookies ( app.component.ts ) and should redirect to a new component passing the read values. How can I do this? Currently, my server provides the required values as html tag attributes to <app-root> (eg <app-root something="someValue"> ) and the AppComponent reads the attributes using this.el.nativeElement.getAttribute("somethings") . Though it works, I'll prefer to read the values from Cookies or from say an HTTP Header Is there a