angular6

ag-grid gridApi.setFilterModel() model with multiple conditions [angular6]

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-24 08:58:40
问题 I want to filter my table based on a set of rules. I found that this was possible to do via filtermodels and conditions. I tried to stack conditions but that doesn't seem to work. e.g. This works Filter = { columnName: { condition1 : { type: 'contains', filter: 'searchstring1', }, operator: 'AND', condition2 : { type: 'contains', filter: 'searchstring2', }, }, }; This does not work. Filter = { columnName: { condition1 : { condition1 : { type: 'contains', filter: 'searchstring1', }, operator:

How to validate input fields one by one in Angular 6

半城伤御伤魂 提交于 2019-12-24 08:46:43
问题 I am new to angular here I am trying to validate a small form .In this case everything is working fine . What I want to do is if a user click on SAVE button without touching the form fields I want to display the error message in the first field only instead of all the fields. Now it's showing error message in all the fields which spoils the look and feel. So how to show the error message on first filed if the user clicked on SAVE button without enter anything in form.It should work if the

deviceready Event not fired in an Angular hybrid app

落爺英雄遲暮 提交于 2019-12-24 08:06:21
问题 I am building an all platform Angular 6 APP that is going to be wrapped with Cordova 8.1.2 Unfortunately I cannot make the deviceready event to fire. I have two separate projects one for Angular and one for Cordova and I am able to build to build the Angular project and create an android apk with the following command: ng build --prod --base-href . --output-path ../Cordova/CordovaMobileApp/www/ & cd ../Cordova/CordovaMobileApp & cordova run android & cd ../../NxAngularMVI Now however I need

Toggle div with Angular 6

╄→гoц情女王★ 提交于 2019-12-24 07:46:18
问题 I'm new to Angular and want to start with something simple to learn. I'm currently developing a form and have divs which I need to toggle upon user selection. Do I need to create Angular 6 component to create such a toggle function? How can I do the toggle - whether with component or without (if possible)? Thanks 回答1: You could try something like: const isOpened = true; <div *ngIf="isOpened"> <form> </form> <div> <div *ngIf="!isOpened"> <form> </form> <div> 来源: https://stackoverflow.com

Reactive Form - Input field focus out automatically - Angular

泪湿孤枕 提交于 2019-12-24 07:26:02
问题 I am having strange issue. Demo .ts import { Component } from '@angular/core'; import { FormGroup, FormBuilder } from '@angular/forms'; @Component({ selector: 'my-app', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { myForm: FormGroup; constructor(private formBuilder: FormBuilder) {} ngOnInit() { this.myForm = this.formBuilder.group({ 'options': this.formBuilder.array([this.createOption()]) }); } createOption(): FormGroup { return this

Angular HttpInterceptor not working with forkJoin

99封情书 提交于 2019-12-24 06:43:55
问题 I have Service to get the token from type Observable and HttpInterceptor to use it to inject the token in every http request. The thing is it works fine with a single request but if i used forkJoin i will not get any response back. the interceptor code import { HttpErrorResponse, HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Observable, } from 'rxjs'; import { catchError, map, switchMap } from 'rxjs

angular router-outlet load before header component, how to prevent?

隐身守侯 提交于 2019-12-24 06:13:27
问题 As in the app-component.html below. The router-outlet components load before app-header component. How to prevent router components to load before header and footer. <!--The content below is only a placeholder and can be replaced.--> <app-header *ngIf="router.url !== '/login' && router.url !== '/register-user'"> </app-header> <div> <router-outlet></router-outlet> </div> <app-footer *ngIf="router.url !== '/login' && router.url !== '/register-user'"></app-footer> 来源: https://stackoverflow.com

angular router-outlet load before header component, how to prevent?

十年热恋 提交于 2019-12-24 06:11:02
问题 As in the app-component.html below. The router-outlet components load before app-header component. How to prevent router components to load before header and footer. <!--The content below is only a placeholder and can be replaced.--> <app-header *ngIf="router.url !== '/login' && router.url !== '/register-user'"> </app-header> <div> <router-outlet></router-outlet> </div> <app-footer *ngIf="router.url !== '/login' && router.url !== '/register-user'"></app-footer> 来源: https://stackoverflow.com

Change color of mat-spinner

醉酒当歌 提交于 2019-12-24 05:39:13
问题 How to change color of mat-spinner i tried this but doesn't work Html <mat-spinner [color]="red" ></mat-spinner> <mat-spinner [color]="#ffffff" ></mat-spinner> 回答1: This code worked for me : scss .mat-spinner-color::ng-deep circle{ stroke: #FFFFFF !important; } html <mat-spinner [diameter]="25" class="mat-spinner-color"></mat-spinner> 回答2: The color input accepts three values: primary : The primary palette of your app warn : The warn palette of your app accent : The accent palette of your app

Angular6 Jasmine TypeError: expect(…).toBeVisible is not a function

霸气de小男生 提交于 2019-12-24 05:07:05
问题 Setting up jasmine-query-matches in angular6 On angular 5 project it looks at simple as import { } from 'jasmine-jquery/lib/jasmine-jquery'; import { } from 'jasmine-jquery-matchers'; import * as $ from 'jquery'; On angular 6 i have tried the following import {} from "jasmine-jquery/lib/jasmine-jquery" ; import {} from "jasmine-jquery-matchers/dist/jasmine-jquery-matchers" ; import { } from "karma-jasmine-jquery"; import * as $ from 'jquery'; OR import {} from "jasmine-jquery" ; import {}