angular-material

Angular-Material set a Datepicker with only months and years

天涯浪子 提交于 2020-01-23 01:30:16
问题 I'm using angular 1.5.9 & angular material design 1.1.1 I would like to add a Datepicker with months and years only, no days, it's for a credit card expiration field in a checkout form. 回答1: You can set md-mode="month" working demo below <md-input-container flex="100" layout="column"> <div style="font-size: 10px; color: blue;" label ng-bind="::dateFields[2].label"></div> <md-datepicker ng-model="dateFields.selectedDate" ng-required="dateFields.required" md-date-locale="dateFields.locale" md

Inconsistent validation issue in Angular custom component

末鹿安然 提交于 2020-01-22 13:13:46
问题 To show a kind of real world example, let's say that we want to use the @angular/material's datepicker in our application. We want to use it on a lot of pages, so we want to make it very easy to add it to a form with the same configuration everywhere. To fulfill this need, we create a custom angular component around a <mat-datepicker> with ControlValueAccessor implementation to be able to use [(ngModel)] on it. We want to handle the typical validations in the component, but in the same time,

How to add a position strategy to an overlay? (Angular Material)

眉间皱痕 提交于 2020-01-22 12:37:04
问题 How on earth do I add a position strategy ( ConnectedPositionStrategy ) to an overlay? (I'm using Angular Material.) I've tried specifying it via the positionStrategy property and passed it in to overlay.create() . import { Overlay, ConnectedPositionStrategy } from '@angular/cdk/overlay'; // ... export class MyComponent { constructor(private overlay: Overlay){} showOverlay() { let overlay = this.overlay.create({positionStrategy: ConnectedPositionStrategy}); // ... } } But I get this error:

mat-filtering/mat-sort not work correctly when use ngif in mat-table parent

旧时模样 提交于 2020-01-22 12:04:18
问题 Note that paging/sort not work correctly. Paging does not show the number of elements it is showing and sorting does not work, but if you delete the line in the html file *ngIf="dataSource?.filteredData.length > 0" the error is fixed. If you use filtering, it works, but it does not show the filter amount Check the example. https://stackblitz.com/edit/angular-wqkekh-nm3pn2?file=app/table-pagination-example.html 回答1: In your component.ts, replace this code @ViewChild(MatPaginator) paginator:

mat-filtering/mat-sort not work correctly when use ngif in mat-table parent

亡梦爱人 提交于 2020-01-22 12:02:08
问题 Note that paging/sort not work correctly. Paging does not show the number of elements it is showing and sorting does not work, but if you delete the line in the html file *ngIf="dataSource?.filteredData.length > 0" the error is fixed. If you use filtering, it works, but it does not show the filter amount Check the example. https://stackblitz.com/edit/angular-wqkekh-nm3pn2?file=app/table-pagination-example.html 回答1: In your component.ts, replace this code @ViewChild(MatPaginator) paginator:

Search bar Autocomplete from API

╄→尐↘猪︶ㄣ 提交于 2020-01-22 02:47:06
问题 I'm trying to create a book search bar with autocomplete that will show relevant results dynamically with each keypress. Everything is working and I'm getting the data, but results are not showing on the dropdown menu Using angular 8 and Material 8.2.3 I'm trying to create a book search bar with autocomplete that will show relevant results dynamically with each keypress. Everything is working and I'm getting the data, but results are not showing on the dropdown menu import { Component, OnInit

Angular Mat Table Error: Missing definitions for header and row

女生的网名这么多〃 提交于 2020-01-21 10:36:38
问题 I am using MatTable from Angular Material 5.2.5. I trying to populate the table with data which is got through a server request. The UI <mat-table [dataSource]="dataSource"> <ng-container matColumnDef="number"> <mat-header-cell *matHeaderCellDef>#</mat-header-cell> <mat-cell *matCellDef="let i = index">{{i + 1}}</mat-cell> </ng-container> <ng-container matColumnDef="name"> <mat-header-cell *matHeaderCellDef>Name</mat-header-cell> <mat-cell *matCellDef="let user">{{user.userName}}</mat-cell> <

Pass input value to $mdDialog

橙三吉。 提交于 2020-01-21 10:06:45
问题 I'm trying to pass a form input to my dialog (as title for example). The problem is: it don't get the form $scope . If I set the $scope sinde the controller, it'll display normaly (see the $scope.text for example). But, if I try to get the form $scope (see `$scope.taskTitle) it just don't show anything. See my code: JavaScript app.controller('tasksCtrl', ['$scope', '$mdDialog', function($scope, $mdDialog){ $scope.teste = 'Just a test, dude'; $scope.expandTask = function() { $mdDialog.show({

Pass input value to $mdDialog

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-21 10:06:11
问题 I'm trying to pass a form input to my dialog (as title for example). The problem is: it don't get the form $scope . If I set the $scope sinde the controller, it'll display normaly (see the $scope.text for example). But, if I try to get the form $scope (see `$scope.taskTitle) it just don't show anything. See my code: JavaScript app.controller('tasksCtrl', ['$scope', '$mdDialog', function($scope, $mdDialog){ $scope.teste = 'Just a test, dude'; $scope.expandTask = function() { $mdDialog.show({

md-items is not updating the suggesion list properly in md-autocomplete Angular Material

时光总嘲笑我的痴心妄想 提交于 2020-01-21 05:12:06
问题 I'm using md-autocomplete, in that md-items which is not updating the response list properly which is obtained from the Service Host - Ajax Call. HTML Source Code <md-autocomplete flex required md-input-name="autocompleteField" md-no-cache="true" md-input-minlength="3" md-input-maxlength="18" md-selected-item="SelectedItem" md-search-text="searchText" md-items="item in querySearch(searchText)" md-item-text="item.DisplayName" Placeholder="Enter ID" style="height:38px !important;"> <md-item