angular7

How to downgrade angular7 to angular6

假如想象 提交于 2019-12-05 20:01:35
I have tried to downgrade angular 7 to angular 6 by running the following npm commands: npm uninstall -g angular-cli npm cache clean npm install -g angular-cli@6.1.1 However angular/cli 7 version is still displaying in my package.json file. I need help to downgrade angular7 to angular6 . You need to set the version numbers in your package.json for (at least) this packages "@angular/animations": "^7.0.0", "@angular/cdk": "7.3.3", "@angular/common": "^7.0.0", "@angular/compiler": "7.2.6", "@angular/core": "7.2.6", "@angular/forms": "^7.0.0", "@angular/http": "^7.0.0", "@angular/material": "7.3.3

angular 7 does not ask if to use routing when i create a new project

好久不见. 提交于 2019-12-05 16:20:43
I was formerly using Angular version 6, now I have upgraded to 7. But when I try to create a new project in CLI using ng new [app-name] it just starts without asking if I want to include routing in my project or the styling. P.S: I have the latest version of Angular i.e 7.0.2. veeresh patil ng new {Project-name} command by default creates project without routing. You need to set routing flag as true while creating project as below(by default this routing flag will be false), ng new {Project-name} --routing=true Go through angular documentation for more details ng new --help run this command

Angular 7: Clear selection with x-button on a dropdown box

匆匆过客 提交于 2019-12-05 09:53:45
I thought I can combine the examples from Angular for dropdown and the Input with clear box to: <mat-form-field > <mat-select placeholder="Country" [(value)]="selectedCountry" (selectionChange)="emitItemChanges()"> <div *ngFor="let item of lstItems|async"> <mat-option *ngIf="addItem(item)" [value]="item">{{item.title}}</mat-option> </div> </mat-select> <button mat-button *ngIf="selectedCountry" matSuffix mat-icon-button aria-label="Clear" (click)="selectedCountry=undefined"> <mat-icon>close</mat-icon> </button> </mat-form-field> Which works close to the way as intended which clears the input.

error TS2554: Expected 2 arguments, but got 1 with @ViewChild

青春壹個敷衍的年華 提交于 2019-12-05 08:46:19
问题 I was using ViewChild as follows: @ViewChild("InternalMedia") localStream; @ViewChild("emoji") mEmoji; Which was working fine till angular-7.x as soon as I upgraded it to angular-8.x it started giving following error .../call_emoji/component.ts(41,4): error TS2554: Expected 2 arguments, but got 1. I checked https://angular.io/api/core/ViewChild and when I change it to @ViewChild("InternalMedia",{static:false}) remoteStream; It works. I'm not getting what static does and what should be it's

CORS error when adding Azure AD authentication

时光怂恿深爱的人放手 提交于 2019-12-05 00:33:25
问题 Trying to add Azure AD authentication to an Angular 7 webapp with a .net core 2.1 backend. However, I get the CORS error during the request. "Access to XMLHttpRequest at 'https://login.microsoftonline.com/.......' (redirected from 'https://localhost:5001/api/auth/login') from origin 'https://localhost:5001' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource." So I tried adding some CORS policy in the startup pipe-line. Startup.cs

How to implement a global loader in Angular 7.1

你说的曾经没有我的故事 提交于 2019-12-04 23:11:41
I have a global loader which is implemented like this: CoreModule: router.events.pipe( filter(x => x instanceof NavigationStart) ).subscribe(() => loaderService.show()); router.events.pipe( filter(x => x instanceof NavigationEnd || x instanceof NavigationCancel || x instanceof NavigationError) ).subscribe(() => loaderService.hide()); LoaderService: @Injectable({ providedIn: 'root' }) export class LoaderService { overlayRef: OverlayRef; componentFactory: ComponentFactory<LoaderComponent>; componentPortal: ComponentPortal<LoaderComponent>; componentRef: ComponentRef<LoaderComponent>; constructor

Angular build for production fails

强颜欢笑 提交于 2019-12-04 20:59:27
When I try to build for production my angular application with the following command ng build --prod --build-optimizer I get the following output: Date: 2019-01-29T08:39:12.193Z Hash: 05648c76cf91b1245f68 Time: 27920ms chunk {0} runtime.1eee2a92f0ed121267d0.js (runtime) 2.22 kB [entry] [rendered] chunk {1} 1.71c6b320e46d84e7f880.js () 88.8 kB [rendered] chunk {2} main.058aa675d38205a01c2e.js (main) 1.65 MB [initial] [rendered] chunk {3} polyfills.6226af78bf8dfb509e3e.js (polyfills) 61.7 kB [initial] [rendered] chunk {4} styles.dec6a5db702d518085c9.css (styles) 61.2 kB [initial] [rendered]

Develop common Dialog Box Service using Angular 7

旧巷老猫 提交于 2019-12-04 20:51:10
I am working on Angular 7 and looking to develop common component or service to show Alerts/Dialog Box when User Confirming/Deleting details on button click. I went through link: https://firstclassjs.com/create-a-reusable-confirmation-dialog-in-angular-7-using-angular-material/ and on web I found the many people are using Angular Material way to implement. Is there any simple way to dynamically pass the title and message to alert service or component based on action like Update/Delete you're performing ? Can anyone please share the sample code for the same ?? In app.component.ts you need to

Input box attribute set dynamically on radio button change

ぃ、小莉子 提交于 2019-12-04 19:53:03
I am having 20 mat-expansion-panel and each expansion-panel having one radio group and each radio group having 5 radio buttons, and below radio button there is one comment box. So I want something like when i select third radio button then specific this expansion-panel comment box will optional otherwise it's required. Currently, change happening in all mat-expansion-panel so want do changes on a specific panel that i have select radio button. So can you please provide me an example something like it. My Json Data : { "id":"2", "category":"Charactor", "questions":[ { "id":"22", "question":"How

Loop array and return data for each id in Observable

北城余情 提交于 2019-12-04 15:50:08
问题 Using RxJS v6 is challenging to retrieve data from sub collection for every item in the loop. There is no way to iterate throw array that is retrieved from HTTP call. Merge map does it only for single item where there is a requirement to do it on all array items. I've been stuck on this for 3 days. I've tried everything. Problem is that new pipe syntax while provides you with neat way to organise code there is no easy way to loop throw collection of data. It is impossible to use map