angular6

How to add active class on selected chat list item (Angular)?

纵然是瞬间 提交于 2019-12-11 16:41:34
问题 We are trying to complete this chat component. When the user clicks on the left side chat item it opens messages with that chosen user. We have an active class that changes chat list item color. Trying to implement active class when the user selects any chat list item. Here is the code: Messages service import { Observable } from 'rxjs'; import { HttpClient } from '@angular/common/http'; import { Injectable,EventEmitter } from '@angular/core'; import { Message } from '@angular/compiler/src

ReferenceError: $ is not defined in Angular

戏子无情 提交于 2019-12-11 16:38:34
问题 I want to show a dialog box when my application starts but I am getting error ReferenceError: $ is not defined even though I have defined it like declare var $: any; . The demo is at https://stackblitz.com/edit/angular-gnwe2c If you check the console, you'll see the error. I have defined an DialogComponent which is simply Bootstrap modal in dialog.component.html . It has a method showDialog which call's Bootstrap 's modal method $(this.dialogRef.nativeElement).modal('show'); . In app

How to use edit and delete options in Angular NGX-Datatables

倾然丶 夕夏残阳落幕 提交于 2019-12-11 16:32:58
问题 I am working on an angular project where I am using ngx-datatables to show data in tables. Here I am trying to add edit(not inline) and delete functionality in it. I have created a template to use in edit and refer it in cellTemplate of column's array. But I am getting EmployeeId in this cellTemplate, may be I have not proceed it the way it should work. How to get the edit icon and pass routerLink property with related EmployeeId value to each anchor tag in the template. <ngx-datatable class=

RegExp.test not giving correct result

梦想与她 提交于 2019-12-11 16:09:07
问题 In the following code, I pass a FormControl which contains a password. I expect that when the password is aA1[11] , the RegExp.test method should return false but it returns true! Why my code is returning null instead of error object { validatePassword: { valid: false, message: 'password must contain 1 small-case letter [a-z], 1 capital letter [A-Z], 1 digit[0-9], 1 special character and the length should be between 6-10 characters' } Shouldn't this forward look up fail the match (?=.*[!@#$%^

Not loading image from local path in Angular 7

邮差的信 提交于 2019-12-11 15:53:13
问题 It's not loading any image from local path, but loading images from internet. Please help me load images from local. I have created the folder containing images inside the project itself. test.component.ts import { Component, OnInit } from '@angular/core'; @Component({ selector: 'test-app', templateUrl: './test.component.html' }) export class TestComponent implements OnInit { image1= '/img1.png'; image2= 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQCNTJ-wSPyf8KvKYO

How to implement Virtual scroll on material tree grand child level

ぃ、小莉子 提交于 2019-12-11 15:51:24
问题 I have an angular mat-tree with parent, child and grand child level. On clicking of child I am adding grandchild in it. But grandchild having huge data upto 4k records. Which is making tree extremely slow. My code as below <div *ngIf="isGrandChildLoaded"><mat-spinner></mat-spinner></div> <mat-tree [dataSource]="dataSource" [treeControl]="treeControl"> <!-- This is the tree node template for leaf nodes --> <mat-tree-node *matTreeNodeDef="let node" matTreeNodePadding> <!-- use a disabled button

Angular 6 Reactive Forms Custom Validator getting error shown from Default Data

馋奶兔 提交于 2019-12-11 15:41:19
问题 I have a FormArray in a FormGroup and each of the FormArray has multiple FormGroup's and can add them dynamically. I have a Custom Validator where it checks with all the data in each of the FormArray to validate the repetition of data. Currently, it's also validating the initial data with itself which is throwing an error. Is there any way to restrict the error from throwing itself when it's checking the initial data.? It's working fine when new data is added and has same values as the

unable to create a nested Reactive Form

六眼飞鱼酱① 提交于 2019-12-11 15:41:13
问题 The code/demo is at https://stackblitz.com/edit/angular-jx7fdu I am trying to create a nested Reactive Form. It is a simple signup form. It has Firstname , Lastname , email , Password and VerifyPassword Field. I have also created validators for the fields. The html also assigns Bootstrap 's classes depending on whether a field has errors or not. <input id="firstname" type="text" class="form-control" formControlName="firstName" [ngClass]="validateField(signupForm,'firstName')" > <app-show

Instead of displaying user list infinite scroll generates just unlimited empty list (Ionic 3)

拟墨画扇 提交于 2019-12-11 15:23:00
问题 We try to implement infinite scroll for ionic 3 Users list component. The problem is that after implementing ionic's infinite scroll component it destroys users component. Instead of showing users it shows empty list and regularly generates a new list with infinite scroll. So infinite scroll works fine but it shows empty unlimited lists instead of showing users. constructor( ...) { this.socket = io('http://localhost:3000'); console.log(this.groupFilters); for (let i = 0; i < 4; i++) { this

How to manipulate DOM elements inside a TemplateRef without using pure javascript

假如想象 提交于 2019-12-11 15:18:51
问题 I have this template in my Component class <ng-template #thumbnailTemplate> <div> <!-- top level div of thumbnail. This will have ids thumbnail-1, thumbnail-2 etc.--> <img> <!-- this will have width, height=80--> <a></a> <!-- the X button is created using CSS. This will have ids close-button-1, close-button-2. They'll also containn reference to the parent div id (thumbnail-1, thumbnail-2 ) --> </div> </ng-template> <div class="form-group"> <div class="custom-file" id="file-upload" lang="es">