angular5

How to access properties of angular material components?

三世轮回 提交于 2021-02-20 10:13:01
问题 I'm fairly new to angular in general, i have built my first few apps with it and right now I'm working on some project that contains angular material. When i go to this site i see lots of properties of the MatSelect directive. There is one property called 'empty: boolean' that I would like to access in some way, but i don't know how, can you help me? 回答1: Pay attention to Exported as:matSelect . You can reference it by template reference variable(#var) or by ViewChild: <mat-select #matSelect

How to access properties of angular material components?

回眸只為那壹抹淺笑 提交于 2021-02-20 10:12:23
问题 I'm fairly new to angular in general, i have built my first few apps with it and right now I'm working on some project that contains angular material. When i go to this site i see lots of properties of the MatSelect directive. There is one property called 'empty: boolean' that I would like to access in some way, but i don't know how, can you help me? 回答1: Pay attention to Exported as:matSelect . You can reference it by template reference variable(#var) or by ViewChild: <mat-select #matSelect

Sending Variable from Component to Service in Angular 5

…衆ロ難τιáo~ 提交于 2021-02-20 03:49:37
问题 In my current Angular 5 project, I have been making successful API calls from my service (Code kept clean for brevity) myService.ts : @Injectable() export class my-service-service { constructor(private _http: HttpClient) { } myData1() { return this._http.get("API_URL") .map(result => result); } And accessing that information on my connected component by subscribing to the above service. myComponent.ts: import { myServiceService } from './my-service-service.service'; @Component({ ... })

Sending Variable from Component to Service in Angular 5

烂漫一生 提交于 2021-02-20 03:47:01
问题 In my current Angular 5 project, I have been making successful API calls from my service (Code kept clean for brevity) myService.ts : @Injectable() export class my-service-service { constructor(private _http: HttpClient) { } myData1() { return this._http.get("API_URL") .map(result => result); } And accessing that information on my connected component by subscribing to the above service. myComponent.ts: import { myServiceService } from './my-service-service.service'; @Component({ ... })

Angular with Azure AD B2C Audience Validation Failed

Deadly 提交于 2021-02-19 08:39:06
问题 I have an Anuglar5 spa frontend and ASP.NET Core API. Both secured by Azure AD B2C service. The angular application redirects correctly to the login page and signing in returns a token. When I try to call the API with the token I get; AuthenticationFailed: IDX10214: Audience validation failed. Audiences: '627684f5-5011-475a-9cbd-55fcdcdf369e'. Did not match: validationParameters.ValidAudience: 'ee8b98a0-ae7a-38b2-9e73-d175df22ef4c' or validationParameters.ValidAudiences: 'null'. "627684f5

What is the benefit of using observable in Angular 5 http requests?

只谈情不闲聊 提交于 2021-02-19 05:12:18
问题 I am confused about using httpclient in angular 5.I am new to angular and just following the official angular tutorial.I dont know much about observables,promise,pipe etc..Currently I am having a service for handling all the http methods.For post request I am using with pipe.Below is the method. create(model: any,URI) :Observable<Object>{ return this.http.post(API_URL+URI, model) .pipe( catchError(this.handleError('create', model)) ); } private handleError<T> (operation = 'operation', result?

Materializecss angular 5 dropdown content dynamic generation throws error

ぐ巨炮叔叔 提交于 2021-02-18 19:22:48
问题 When I generate dynamic content with different dropdowns the dropdown throws an error. If I do not generate dynamic dropdown content it works, the problem is with that generation. It throws this error: ERROR TypeError: Cannot set property 'tabIndex' of null html <ul id="content-{{labSystem.system.name}}" class="dropdown-content" *ngFor="let labSystem of nodeLabSystems"> <li> <a href="#!">one</a> </li> </ul> <div class="col s12 m12 l12 xl12 blue-grey lighten-1"> <div id="instrumentStatus">

Error when compiling Universal Angular with ngx-translate

ε祈祈猫儿з 提交于 2021-02-17 05:45:12
问题 I am configuring ngx-translate as follows: translate-server-loader.service.ts import {Observable} from "rxjs/Observable"; import {TranslateLoader} from '@ngx-translate/core'; import { Injectable } from '@angular/core'; import {makeStateKey, StateKey, TransferState} from '@angular/platform-browser'; import {TranslateHttpLoader} from '@ngx-translate/http-loader'; import {HttpClient} from '@angular/common/http'; @Injectable() export class TranslateBrowserLoader implements TranslateLoader {

Service worker Angular 5

情到浓时终转凉″ 提交于 2021-02-11 13:54:00
问题 Service worker doesn't work after deploy to Azure. My json: { "index": "/index.html", "assetGroups": [ { "name": "app", "installMode": "prefetch", "resources": { "files": [ "/index.html" ], "versionedFiles": [ "/*.bundle.css", "/*.bundle.js", "/*.chunk.js" ] } }, { "name": "assets", "installMode": "lazy", "updateMode": "prefetch", "resources": { "files": [ "/assets/**", "favicon.ico" ] } }]} In .angular-cli.json added "serviceWorker": true In app.module.ts added ServiceWorkerModule.register('

Date pipe is Working fine in Html Interpolation but not Working in Mat-DatePicker Input Fields

时光总嘲笑我的痴心妄想 提交于 2021-02-10 23:16:03
问题 I want to display a date in dd/MM/YYYY format when a user pick the date using the mat Datepicker but when i use the Datepipe in Datepicker it not shows any Date when we pick <mat-form-field class="box"> <input matInput [matDatepicker]="picker" placeholder="Generate Date" maxlength="10px" [readonly]="isNew1" [ngModel]="quotation?.generateDate | date: 'dd/MM/yy'" (ngModelChange)="quotation.generateDate=$event" [ngModelOptions]="{standalone: true}"> <mat-datepicker-toggle matSuffix [for]="picker