angular6

Angular 6 - Refused to apply style from '…' because its MIME type ('text/html') is not a supported stylesheet

霸气de小男生 提交于 2019-12-22 08:48:08
问题 Trying to upgrade to Angular 6 and got the below error when I referred the below in index.html: Refused to apply style from 'https://localhost:44394/~/assets/primengcss/themes/omega//theme.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled. 回答1: Found the answer (at least worked for me), after some digging around: Looks like inAngular 6 we need to include any external CSS (like bootstrap, fontawesome, Primeng etc.,) to the

Angular 6: ERROR TypeError: Cannot read property 'toLowerCase' of undefined

倖福魔咒の 提交于 2019-12-22 06:59:35
问题 I am creating CRUD app in angular six about users, when I am trying to add new user I am getting the following error: Here is the error I am getting : core.js:12301 ERROR TypeError: Cannot read property 'toLowerCase' of undefined at HttpXsrfInterceptor.push../node_modules/@angular/common/fesm5/http.js.HttpXsrfInterceptor.intercept (http.js:1718) at HttpInterceptorHandler.push../node_modules/@angular/common/fesm5/http.js.HttpInterceptorHandler.handle (http.js:1134) at HttpInterceptingHandler

Current selected value in angular6 material mat-selection-list

断了今生、忘了曾经 提交于 2019-12-22 06:45:05
问题 Working with Angular Material2 mat-selection-list , Able to identify whether current option is selected or non-selected[Boolean]. compnenent.html <mat-selection-list #shoes (selectionChange)="onSelection($event, shoes.selectedOptions)" > <mat-list-option *ngFor="let shoe of typesOfShoes" [value]='shoe'> {{shoe}} </mat-list-option> </mat-selection-list> component.ts export class ListSelectionExample { typesOfShoes = ['Boots', 'Clogs', 'Loafers', 'Moccasins', 'Sneakers']; onSelection(e, v){

child parent communication best practices in Angular

a 夏天 提交于 2019-12-22 06:01:25
问题 I'm trying to become better at Angular and I want to know the best practices between child-parent communication. My current app I want to work on is on Angular 6. I know I can communicate between child-parent components using @ViewChild, @Output or creating a service. Is there another way to do the communication? if not which one of those 3 is better and why? Here's a simple example: Child HTML <button (click)="onLinkedClicked();">Click me</button> Child TS import { Component, OnInit, Input,

child parent communication best practices in Angular

会有一股神秘感。 提交于 2019-12-22 06:01:13
问题 I'm trying to become better at Angular and I want to know the best practices between child-parent communication. My current app I want to work on is on Angular 6. I know I can communicate between child-parent components using @ViewChild, @Output or creating a service. Is there another way to do the communication? if not which one of those 3 is better and why? Here's a simple example: Child HTML <button (click)="onLinkedClicked();">Click me</button> Child TS import { Component, OnInit, Input,

directive click outside angular 6

懵懂的女人 提交于 2019-12-22 04:33:17
问题 I upgraded my Angular from 4 to 6, and consequently had a problem with my click-off policy, it stopped working on all components. my directive: import { Directive, Output, EventEmitter, ElementRef, HostListener } from '@angular/core'; @Directive({ selector: '[clickOutside]' }) export class ClickOutsideDirective { constructor(private _elementRef : ElementRef) { } @Output() public clickOutside = new EventEmitter(); @HostListener('document:click', ['$event.target']) public onClick(targetElement)

Angular 6 StaticInjectorError: No provider for Options

让人想犯罪 __ 提交于 2019-12-22 04:19:09
问题 I have recently updated my project from Angular5 to Angular6. The project is building successfully but I am getting the following error in the browser console: Unhandled Promise rejection: StaticInjectorError(AppModule)[options]: StaticInjectorError(Platform: core)[options]: NullInjectorError: No provider for options! ; Zone: ; Task: Promise.then ; Value: Error: StaticInjectorError(AppModule)[options] Any idea on how to debug these issues? Here's my app.module: import { BrowserModule } from '

Angular NoopAnimationsModule Type Error matches Element is not a function

萝らか妹 提交于 2019-12-22 02:49:14
问题 I'm getting this error after importing NoopAnimationsModule for my Angular 6 app ERROR TypeError: this.driver.matchesElement is not a function at TransitionAnimationEngine.push../node_modules/@angular/animations/fesm5/browser.js.TransitionAnimationEngine.processLeaveNode (browser.js:2976) 回答1: This happened to me a few hours ago, and was probably caused by some outdated modules. Running npm update --save fixed it. 回答2: @angular/core and @angular/animations should be same version. Especially

Angular NoopAnimationsModule Type Error matches Element is not a function

二次信任 提交于 2019-12-22 02:49:11
问题 I'm getting this error after importing NoopAnimationsModule for my Angular 6 app ERROR TypeError: this.driver.matchesElement is not a function at TransitionAnimationEngine.push../node_modules/@angular/animations/fesm5/browser.js.TransitionAnimationEngine.processLeaveNode (browser.js:2976) 回答1: This happened to me a few hours ago, and was probably caused by some outdated modules. Running npm update --save fixed it. 回答2: @angular/core and @angular/animations should be same version. Especially

How can I use two translators first for JSON file and second for firestore?

扶醉桌前 提交于 2019-12-22 01:32:02
问题 JSON File Method export function createTranslateLoader(http: HttpClient) { return new TranslateHttpLoader(http, './assets/i18n/', '.json'); } JSON File Loader TranslateModule.forRoot({ loader: { provide: TranslateLoader, useFactory: (createTranslateLoader), deps: [HttpClient] } }), AngularFirestore Method export function FirestoreTranslationsLoaderFactory(db: AngularFirestore) { return new FirestoreTransLoader(db); } AngularFirestore File Loader TranslateModule.forRoot({ loader: { provide: