angular6

angular material 6 multiple mat-sliders with different colors

大憨熊 提交于 2021-02-10 18:10:29
问题 i have 3 'mat-slider's in a page and i want to have 3 different colors for the sliders. i cant override the theme colors for the page(component) as it will apply to all the sliders. do i have to make 3 different components for the sliders and override theme colors in each? what is the easiest way to achieve this? below are my angular and package versions, Angular CLI: 6.0.8 Node: 8.9.4 OS: win32 x64 Angular: 6.0.6 ... animations, common, compiler, compiler-cli, core, forms ... http, language

Image/Video Preview In Angular

依然范特西╮ 提交于 2021-02-10 16:49:26
问题 I'm trying to upload image or video in Angular. I wanted to display its preview. I have no problem in previewing the image, my problem is how can i preview the video? Please see this stackblitz link: CLICK HERE CODE onSelectFile(event) { if (event.target.files && event.target.files[0]) { var reader = new FileReader(); reader.readAsDataURL(event.target.files[0]); reader.onload = (event) => { this.url = event.target.result; } } } 回答1: You can decide if the file is type of video/image and then

Angular Material custom datepicker format throws error “format.replace is not a function”

这一生的挚爱 提交于 2021-02-10 14:23:07
问题 I am working on customising the date to the dd-mmm-yyy ie for eg 12-Feb-2019, working using the angular material 6 and this is my code, I have not used a replace function but yet get this error The component file content import { MomentDateAdapter ,MatMomentDateModule } from '@angular/material-moment-adapter'; import {DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE} from '@angular/material/core'; import {MatDatepicker} from '@angular/material/datepicker'; import {default as _rollupMoment,

How to watch service variable in Angular 6

蹲街弑〆低调 提交于 2021-02-10 05:20:08
问题 ive been trying to make Angular update the service variable "open_popup" for days with no luck. TLDR; What I'm trying to do, is whenever the variable "open_popup" changes, make it change on the component too also be able to change the service variable from a component function. This is what I've tried so far. app/src/app/audience-creator/shared/audience-creator.service.ts import { Injectable } from "@angular/core"; import {Observable} from "rxjs/index"; import { of } from "rxjs/index";

How to watch service variable in Angular 6

孤街浪徒 提交于 2021-02-10 05:20:07
问题 ive been trying to make Angular update the service variable "open_popup" for days with no luck. TLDR; What I'm trying to do, is whenever the variable "open_popup" changes, make it change on the component too also be able to change the service variable from a component function. This is what I've tried so far. app/src/app/audience-creator/shared/audience-creator.service.ts import { Injectable } from "@angular/core"; import {Observable} from "rxjs/index"; import { of } from "rxjs/index";

Very unintuitive “Unexpected closing tag” error on a valid template

送分小仙女□ 提交于 2021-02-09 00:47:32
问题 It's my first day of learning angular and I've encountered a very unintuitive error message, which says: Uncaught Error: Template parse errors: Unexpected closing tag "p". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags (" Number {{ i + 1 }}: {{ phoneNumber }} [ERROR ->] "): ng:///AppModule/AddressCardComponent.html@5:0 The error is thrown on a valid html template that

Very unintuitive “Unexpected closing tag” error on a valid template

筅森魡賤 提交于 2021-02-09 00:47:11
问题 It's my first day of learning angular and I've encountered a very unintuitive error message, which says: Uncaught Error: Template parse errors: Unexpected closing tag "p". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags (" Number {{ i + 1 }}: {{ phoneNumber }} [ERROR ->] "): ng:///AppModule/AddressCardComponent.html@5:0 The error is thrown on a valid html template that

Very unintuitive “Unexpected closing tag” error on a valid template

ぐ巨炮叔叔 提交于 2021-02-09 00:47:04
问题 It's my first day of learning angular and I've encountered a very unintuitive error message, which says: Uncaught Error: Template parse errors: Unexpected closing tag "p". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags (" Number {{ i + 1 }}: {{ phoneNumber }} [ERROR ->] "): ng:///AppModule/AddressCardComponent.html@5:0 The error is thrown on a valid html template that

Type 'Observable<HttpEvent<>>' is not assignable to type 'Observable<>'

半腔热情 提交于 2021-02-08 15:10:35
问题 I have this code snippet: SubmitTransaction(transNumber: string, transactionRequest: ITransactionRequestObj): Observable<TransactionResponse> { this.body = JSON.stringify(transactionRequest); this.headers = new HttpHeaders().set('Content-Type', 'application/json'); this.headers.append('Accept', 'application/json'); this.options = new RequestOptions({headers: this.headers}); return this.http.post<TransactionResponse>(this.baseUrl + '/transactions/' + transNumber + '/new', this.body, this

Unable to post values from angular service to Web API in asp.net core angular

…衆ロ難τιáo~ 提交于 2021-02-08 09:55:04
问题 I am working on asp.net core(2.1) angular project, here I am passing parameters from angular service to web API but I am not getting those values in API. Below is my code, it was working fine when I was using a separate project for Web API. Now as I have created a controller inside the asp.net core project itself I am unable to get posted values in API parameter list. Do I need to add/change some settings to get values from angular service to API call? Angular Service : getSortedPagedResults