angular-material

Angular 9: i18n in TypeScript

回眸只為那壹抹淺笑 提交于 2020-05-13 05:35:06
问题 I studied the new i18n feature in Angular 9. https://angular.io/guide/i18n How to translate text in TypeScript, e.g. SnackBar messages? 回答1: Check this blog https://blog.ninja-squad.com/2019/12/10/angular-localize/ @Component({ template: '{{ title }}' }) export class HomeComponent { title = $localize`You have 10 users`; } And You have to manually add it to your messages.fr.xlf <trans-unit id="6480943972743237078"> <source>You have 10 users</source> <target>Vous avez 10 utilisateurs</target> <

Angular 9: i18n in TypeScript

寵の児 提交于 2020-05-13 05:34:48
问题 I studied the new i18n feature in Angular 9. https://angular.io/guide/i18n How to translate text in TypeScript, e.g. SnackBar messages? 回答1: Check this blog https://blog.ninja-squad.com/2019/12/10/angular-localize/ @Component({ template: '{{ title }}' }) export class HomeComponent { title = $localize`You have 10 users`; } And You have to manually add it to your messages.fr.xlf <trans-unit id="6480943972743237078"> <source>You have 10 users</source> <target>Vous avez 10 utilisateurs</target> <

Why calling detectChanges() inside component doesn't update values, but wrapping code in setTimeout() does it?

依然范特西╮ 提交于 2020-05-11 05:32:29
问题 I'm trying to automatically select the first value from set of options in <mat-autocomplete ...> export class ExampleComponent implements OnInit, AfterViewInit { @ViewChildren('auto') matAutocomplete: QueryList<any>; constructor(private cdr: ChangeDetectorRef) { } ngAfterViewInit() { this.foundItemsList.changes.subscribe(options => { // ---> This simply works! setTimeout(() => this.matAutocomplete.first._keyManager.setFirstItemActive(), 0); // ---> This doesn't works?! No error shown, it just

Get parent hierarchy from a child node in angular 6 material tree

拟墨画扇 提交于 2020-05-10 09:58:30
问题 I am following a tutorial to implement cdk tree in angular 6. I created a tree structure, now I want to get the parent hierarchy from from the child by making it clickable, while there are methods like getDescendants to get children of a node, vice versa is not available. How can I get the parent hierarchy from a child or leaf node. 回答1: I've added these methods to my tree component. Note that I use the flat tree, this won't work for a nested tree. @Component({ selector: 'es-outline-tree', //

Angular Material DatePicker: Month and Day, Exclude Year

本秂侑毒 提交于 2020-05-09 05:22:30
问题 How do I create a Month and Day Date Picker in Angular, excluding hide year? This following link will do a Month and Year picker. I am trying to manipulate it, to do Month and Day. Replacing YYYY with DD is not working. Stackblitz: https://stackblitz.com/angular/gxymgjpprdy?file=src%2Fapp%2Fdatepicker-views-selection-example.ts Real code from Stackblitz: Typescript: import {Component} from '@angular/core'; import {FormControl} from '@angular/forms'; import {MomentDateAdapter, MAT_MOMENT_DATE

Angular Material DatePicker: Month and Day, Exclude Year

☆樱花仙子☆ 提交于 2020-05-09 05:21:09
问题 How do I create a Month and Day Date Picker in Angular, excluding hide year? This following link will do a Month and Year picker. I am trying to manipulate it, to do Month and Day. Replacing YYYY with DD is not working. Stackblitz: https://stackblitz.com/angular/gxymgjpprdy?file=src%2Fapp%2Fdatepicker-views-selection-example.ts Real code from Stackblitz: Typescript: import {Component} from '@angular/core'; import {FormControl} from '@angular/forms'; import {MomentDateAdapter, MAT_MOMENT_DATE

Angular 6 Material - Hues and How to change the color of mat radio button

我与影子孤独终老i 提交于 2020-05-09 04:51:29
问题 How can I change the color of the using CSS? Saw on another post that if I use the following code, it would change it, but I had no luck with it so far. .mat-radio-button.mat-accent .mat-radio-ripple .mat-ripple-element { background-color:rgb(255, 37, 37); } .mat-radio-button.mat-accent.mat-radio-checked .mat-radio-outer-circle { border-color: rgb(66, 134, 244); } .mat-radio-button.mat-accent .mat-radio-inner-circle { background-color: rgb(66, 134, 244); } Also, how could I use the rest of

Angular 6 Material - Hues and How to change the color of mat radio button

北战南征 提交于 2020-05-09 04:51:27
问题 How can I change the color of the using CSS? Saw on another post that if I use the following code, it would change it, but I had no luck with it so far. .mat-radio-button.mat-accent .mat-radio-ripple .mat-ripple-element { background-color:rgb(255, 37, 37); } .mat-radio-button.mat-accent.mat-radio-checked .mat-radio-outer-circle { border-color: rgb(66, 134, 244); } .mat-radio-button.mat-accent .mat-radio-inner-circle { background-color: rgb(66, 134, 244); } Also, how could I use the rest of

Angular 6 Material - Hues and How to change the color of mat radio button

北城以北 提交于 2020-05-09 04:51:06
问题 How can I change the color of the using CSS? Saw on another post that if I use the following code, it would change it, but I had no luck with it so far. .mat-radio-button.mat-accent .mat-radio-ripple .mat-ripple-element { background-color:rgb(255, 37, 37); } .mat-radio-button.mat-accent.mat-radio-checked .mat-radio-outer-circle { border-color: rgb(66, 134, 244); } .mat-radio-button.mat-accent .mat-radio-inner-circle { background-color: rgb(66, 134, 244); } Also, how could I use the rest of

cdkDropList with ng-template on dynamic component list do'snt work

帅比萌擦擦* 提交于 2020-04-30 16:04:00
问题 I'm trying to use Drag&Drop features released with Angular Material 7. And dynamically creating component using ng-tempalte. <div cdkDropList (cdkDropListDropped)="dropLocal($event)"> <ng-template #components></ng-template> </div> and added cdkDrag at components. I am using createComponent at parent component to keep on create components. viewContainerRef.createComponent but dragdrop functionality is not functional since cdkDrag must be in a tag nested inside the one with cdkDropList,