angular-material

How to pass the $event to the onEnter function of angular ui router state

蹲街弑〆低调 提交于 2019-12-23 17:26:03
问题 I have a question, maybe a stupid one, I am using ui-router state to open a modal just like explained here, except the part the modal is not ui-bootstrap's it is angular-material's $mdDialog. As some of you know that the $mdDialog slides in from the element clicked not from top-to-center like bootstrap-modal. Right now it is fading in no sliding, I would like to slide the modal from the element. I did created a fiddle for this purpose. Here is the code var app = angular .module('myApp', [

How to center mat-card in angular materials?

江枫思渺然 提交于 2019-12-23 17:21:32
问题 I have a login card that I designed using angular materials, whenever I run it on the page the content sticks to the left of the page. I tried using flex and using layout-align="center center" but I still cannot bring the card to the center of the page What am I doing wrong ? Here is my html: <mat-card class="example-card" layout="row" layout-align="center center"> <mat-card-header> <div class="login-box-header" layout="row" layout-align="center center"> <img src="https://image.ibb.co/hDqa3p

Set default directive for all input in app

倖福魔咒の 提交于 2019-12-23 17:15:54
问题 I use mat-form-field with custom css in order to change the be look like appearance="outline" directive. In Angular Material v 7.2.1 appearance="outline" was added to the mat-form-field options. How can I declare appearance="outline" as a default for each input fields in my app? 回答1: you can try to inject mat-form-field default options in your @NgModule : ... providers: [ { provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, useValue: { appearance: 'outline' } } ], ... There was an issue with this https

Implemented a fixed header but the content is scrolling over the header

匆匆过客 提交于 2019-12-23 15:39:40
问题 I am working with Angular 2 app using angular material and angular flex layout.I have created in my application a login form and a header which is only visible after login in my home page. In my app.component.html I have added my header and applied the below style to get it fixed while scrolling. <div style="margin-bottom:5px; top: 0; position: sticky; z-index: 1; background-color: inherit;"> In my home page I have added a mat-toolbar component, mat-card component and mat-sidenav component.

Angular Material Flexbox - How to add margin between wrapped rows?

拥有回忆 提交于 2019-12-23 11:50:48
问题 I'm using Angular Material and its flexbox functionality. I have now come across an issue that seems to me should be simple, but I have problems with it. I've created this Codepen for demostrating my issue. So I have a row with items that exceed 100% of that row and has wrap enabled, so I get two rows of items without margins, like this: <div class="row" layout="row" layout-wrap="wrap"> <div flex="50" class="item1"></div> <div flex="50" class="item2"></div> <div flex="50" class="item3"></div>

Angular Material - set color palette

旧街凉风 提交于 2019-12-23 10:08:46
问题 I'm trying to setup an Angular project in combination with material design. A part of my package.json looks like this: "dependencies": { "@angular2-material/button": "2.0.0-alpha.3", "@angular2-material/card": "2.0.0-alpha.3", "@angular2-material/checkbox": "2.0.0-alpha.3", "@angular2-material/core": "2.0.0-alpha.3", "@angular2-material/input": "2.0.0-alpha.3", "@angular2-material/list": "2.0.0-alpha.3", "@angular2-material/progress-bar": "2.0.0-alpha.3", "@angular2-material/progress-circle":

Angular - Unexpected value MatDialog imported by the module AppModule

。_饼干妹妹 提交于 2019-12-23 10:06:30
问题 I am trying to integrate Angular Material in Angular but getting following error. The program is compiled successfully but getting this issue in browser. Uncaught Error: Unexpected value 'MatDialog' imported by the module 'AppModule'. Please add a @NgModule annotation. at syntaxError (compiler.js:485) at eval (compiler.js:15226) at Array.forEach (<anonymous>) at CompileMetadataResolver.getNgModuleMetadata (compiler.js:15201) at JitCompiler._loadModules (compiler.js:34385) at JitCompiler.

Angular 5 + Angular Material Select + Reactive Forms == No initial options displayed

大城市里の小女人 提交于 2019-12-23 09:33:00
问题 As the title says, I have a reactive form that has multiple <mat-select> contained within. On initial form load, the initial option is not displayed even though form.value shows it is. Pertinent component.ts: export class DesJobInfoEditComponent implements OnInit { ... currentJobData: IJob; jobTypes: IJobType[]; ... constructor(private fb: FormBuilder) { ... // Construct forms this.createForm(); this.initializeForm(); } createForm() { this.editJobInfoForm = this.fb.group({ ... JobType: '', //

Angular flex-layout - fxLayoutGap causes annoying gap at end of wrapped rows

拟墨画扇 提交于 2019-12-23 09:18:43
问题 Using fxLayoutGap and wrap leaves an annoying margin at the end of each row that is wrapped. Is there a way to fix this? https://stackblitz.com/edit/angular-fxlayoutgap-calc-mralnz?file=app%2Fapp.component.html <div fxLayout="row wrap" fxLayoutGap="25px"> <mat-form-field fxFlex.xs="calc(50%-25px)" fxFlex="calc(33%-25px)"> <input matInput placeholder="Name"> </mat-form-field> <mat-form-field fxFlex.xs="calc(50%-25px)" fxFlex="calc(33%-25px)"> <input matInput placeholder="Occupation"> </mat

mdDialog: catch the onClose event

泄露秘密 提交于 2019-12-23 07:49:43
问题 I'm creating a mailbox in angular. And I would need to save the draft message when the popup to send a message closes. I know there are some alternatives: scope.$on("$destroy", function () { saveMessage() }); and: $mdDialog.show(...).finaly(function(){ saveMessage() }); But both are insufficient: The first is called when the Dialog is already closed. This is due to the requirements unacceptable (there is an iFrame that needs to be open) The second is outside the scope of the controller of the