angular-material2

getting angular material table to work properly with api call

社会主义新天地 提交于 2019-12-06 16:14:47
I am trying to get Angular material table to work with an api call to my database I get the right data I just want to display with the new material table and for some reason this is not working as expected. this is my main component import { Component } from '@angular/core'; import {AosService} from './app.aos.service.component' import {QuoteModel} from './QuoteModel' import {DataSource} from '@angular/cdk'; @Component({ selector: 'app-aos', providers: [AosService], templateUrl: './app.aos.quoteQuery.component.html', styleUrls: ['./app.aos.quoteQuery.component.scss'] }) export class

Placing Amazon Banner | Angular V4

China☆狼群 提交于 2019-12-06 14:09:18
I'm placing an Amazon banner inside an angular material 2 card.But the problem is that it is not rendering.It shows empty div.What could be the reason.Below is the code showing how I did it. <md-card class="full-width full-height border-box "> <div class="adv"> <script type="text/javascript" language="javascript"> var aax_size = '728x90'; var aax_pubname = 'XXXXXXXXXXX'; var aax_src = '302'; </script> <script type="text/javascript" language="javascript" src="http://c.amazon-adsystem.com/aax2/assoc.js"></script> </div> </md-card> I also tried to to bind it using property binding <span

How to set context on an Angular [cdkPortalOutlet]

好久不见. 提交于 2019-12-06 11:04:16
The Portal module in Angular Material (CDK) is a very powerful way to render dynamic content into a 'PortalOutlet'. A Portal<T> can be a TemplateRef where T is the type of the context data. <ng-template cdkPortal let-data> <p>Portal contents {{ data | json }}</p> </ng-template> You get a reference to it with @ViewChild @ViewChild(CdkPortal) myPortalRef: CdkPortal; You can display a portal in a cdkPortalOutlet Content gets inserted here: <ng-template [cdkPortalOutlet]="myPortalRef"></ng-template> This will insert the portal contents into the outlet. But there are two big missing features with

How to add mattooltip by custom directive in Angular

不想你离开。 提交于 2019-12-06 10:03:40
问题 I am creating a custom directive called TooltipDirective whihc is going to add matTooltip to every host element, code is like below import { Directive, ElementRef, Input, OnInit, Renderer } from '@angular/core'; @Directive({ selector: '[tooltip]' }) export class TooltipDirective implements OnInit { @Input() tooltip: string; constructor(private hostElement: ElementRef, private renderer: Renderer) { } ngOnInit() { this.renderer.setElementAttribute(this.hostElement.nativeElement, 'matTooltip',

Using separate components in a linear mat-horizontal-stepper

三世轮回 提交于 2019-12-06 09:38:22
In Angular, is it possible to have a linear stepper where the individual steps are separate components? For example: <mat-horizontal-stepper [linear]="isLinear"> <mat-step [stepControl]="firstFormGroup" label="Some Form"> <first-component></first-component> </mat-step> <mat-step [stepControl]="secondFormGroup" label="Another Form"> <second-component></second-component> </mat-step> <mat-step [stepControl]="thirdFormGroup" label="Review"> <third-component></third-component> </mat-step> </mat-horizontal-stepper> When I try this, I receive the following error upon hitting the matStepperNext button

Angular2 material sidenav - changing rtl/ltr direction dynamically

Deadly 提交于 2019-12-06 09:27:09
I'm trying to change my layout dynamically according to users' language selection and switch from LTR to RTL on the fly. I'm using Angular 2 rc6, material 2.0.0-alpha.9-3 It looks like when the page is loaded, it works perfectly with either rtl or ltr. However, when it's changed dynamically from within the app (see plunker), the direction changes but the generated element md-sidenav-content has a miscalculated margin-right and margin-left. Digging further, I managed to see that the _dir object has an eventEmitter that should watch for on change events of _dir and recalculate the margins

how to select default items in angular material 2 select multiple

六眼飞鱼酱① 提交于 2019-12-06 08:54:02
问题 I'm working on angular 2 material app, I have a case where there is multiselect element and in that I have a list with checkbox so I can select multiple items at a time. I'm able to to that with angular material component, but what I want is 2-3 items to be checked by default, and if I select/deselect a particular item, then I should get checked/selected flag as true/false. <md-select multiple="true" [(mgModel)]="test"> <md-option *ngFor="let l of list" [value]="l"> {{l.name}} </md-option> <

Disable Scrolling when angular-material select is open

无人久伴 提交于 2019-12-06 07:48:35
问题 By default the select-dropwon of angular-material will allow the page to scroll and reposition itself accordingly. On the original page of the material-documentation the select-dropdown shows a differetn behaviour: it blocks scrolling when openend: https://material.angular.io/components/select/overview How can I achieve this behaviour? I did not find any options or switch to disable scrolling when the select is clicked EDIT: I did find that there is a thing called "mat-select-scroll-strategy"

Having issues with ng-idle/core onIdleEnd & Mat-Dialog

此生再无相见时 提交于 2019-12-06 07:35:10
There is an issue I have discovered with Ng-Idle, Material 6 nad Angular 6 "@ng-idle/core": "^6.0.0-beta.3" "@ng-idle/keepalive": "^6.0.0-beta.3" "@angular/core": "^6.1.9" "@angular/cdk": "^6.4.7" "@angular/material": "^6.4.7" The scenario when ever a user has gone idle, a dialog (popup) displays a countdown how long until the user is logged out of the system. If the user return prior to being logged out with mouse activity, the countdown will halt and the dialog will close/disappear. Issue However, in Angular 5, this feature was working fine until I upgraded to Angular 6. When ever the user

how to use scroll event in angular material mat select?

寵の児 提交于 2019-12-06 06:03:31
i have a large list and i want to load it as the user scroll down the select field but how can i get the scroll event in mat-select there is no event that fire the scroll event. <mat-form-field> <mat-select placeholder="Choose a Doctor" formControlName="selectedDoc" (change)="drSelected()"> <div *ngFor="let dr of doctors;let i = index" [matTooltip]="getDocDetail(i)" matTooltipPosition="right"> <mat-option (scroll)="docScroll()" [value]="dr"> {{dr.name}} </mat-option> </div> </mat-select> <mat-hint>List Of Doctor In Your city</mat-hint> <mat-error *ngIf="selectedDoc.hasError('required')">Please