我试图按照https://material.angular.io/components/component/dialog上的文档但我不明白为什么它有以下问题?
我在我的组件上添加了以下内容:
@Component({
selector: 'dialog-result-example-dialog',
templateUrl: './dialog-result-example-dialog.html',
})
export class DialogResultExampleDialog {
constructor(public dialogRef: MdDialogRef<DialogResultExampleDialog>) {}
}
Run Code Online (Sandbox Code Playgroud)
在我的模块中,我补充道
import { HomeComponent,DialogResultExampleDialog } from './home/home.component';
@NgModule({
declarations: [
AppComponent,
LoginComponent,
DashboardComponent,
HomeComponent,
DialogResultExampleDialog
],
// ...
Run Code Online (Sandbox Code Playgroud)
但我得到这个错误....
EXCEPTION: Error in ./HomeComponent class HomeComponent - inline template:53:0 caused by: No component factory found for DialogResultExampleDialog. Did you add it to @NgModule.entryComponents?
ErrorHandler.handleError @ error_handler.js:50
next @ application_ref.js:346
schedulerFn @ async.js:91
SafeSubscriber.__tryOrUnsub @ Subscriber.js:223
SafeSubscriber.next @ Subscriber.js:172
Subscriber._next @ Subscriber.js:125
Subscriber.next …Run Code Online (Sandbox Code Playgroud) 我将使用AngularJS(完整堆栈)开始新项目.我的项目需要响应,我将从头开始创建模板.
所以我需要一个关于是否选择bootstrap 3(带角度指令)或布局材料设计的建议?
如果有人能列出两者的优点和缺点,我将不胜感激.
angularjs twitter-bootstrap-3 material-design angular-material
使用 Angular 8,在构建应用程序时,我们遇到以下错误:
app/modules/admin-module/pages/editor/editor.component.ts:6:27 - error TS2306:
File ...node_modules/@angular/material/index.d.ts' is not a module.
Run Code Online (Sandbox Code Playgroud) 这些是我的文件。我收到此错误有人可以帮助我。
Error: src/app/app.component.html:5:123 - error TS4111: Property 'fName' comes from an index signature, so it must be accessed with ['fName'].
<input id="name" type="text" formControlName="fName" class="form-control" [ngClass]="{'is-invalid':submitted && f.fName.errors}"/>
Run Code Online (Sandbox Code Playgroud)
组件.html
<form [formGroup]="surveyForm" (ngSubmit)="onSubmit()">
<div>
<label>Name:</label>
<input id="name" type="text" formControlName="fName" class="form-control" [ngClass]="{'is-invalid':submitted && f.fName.errors}"/>
<div *ngIf="submitted && f.fName.errors" class="form-control">first name is required</div>
</div>
</form>
Run Code Online (Sandbox Code Playgroud)
组件.ts
import { Component, OnInit } from '@angular/core';
import { FormControl, FormBuilder, FormGroup, Validators} from '@angular/forms';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements …Run Code Online (Sandbox Code Playgroud) 我正在使用Material 2来添加md-raised-button.
我想仅在某些条件成立时应用此指令.
例如:
<button md-raised-button="true"></button>
Run Code Online (Sandbox Code Playgroud)
另一个例子:我在plunker中创建了一个基本的动态反应形式.我正在使用formArrayName反应形式的指令来控制数组.我想formArrayName仅在特定条件成立时才应用指令.否则不添加formArrayName指令.我尝试和研究了很多,但可以找到任何解决方案.
这是plunker链接:https://plnkr.co/edit/oPZ7PyBSf8jjYa2KVh4J ? p = preview
我真的很感激任何贡献.
提前致谢!
angular-material angular2-forms angular2-directives angular-material2 angular
我使用mat-table列出用户所选语言的内容.他们还可以使用对话框面板添加新语言.他们添加了一种语言并返回.我希望我的数据源刷新以显示他们所做的更改.
我通过从服务获取用户数据并将其传递到refresh方法中的数据源来初始化数据存储区.
Language.component.ts
import { Component, OnInit } from '@angular/core';
import { LanguageModel, LANGUAGE_DATA } from '../../../../models/language.model';
import { LanguageAddComponent } from './language-add/language-add.component';
import { AuthService } from '../../../../services/auth.service';
import { LanguageDataSource } from './language-data-source';
import { LevelbarComponent } from '../../../../directives/levelbar/levelbar.component';
import { DataSource } from '@angular/cdk/collections';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/of';
import { MatSnackBar, MatDialog } from '@angular/material';
@Component({
selector: 'app-language',
templateUrl: './language.component.html',
styleUrls: ['./language.component.scss']
})
export class LanguageComponent implements OnInit {
displayedColumns = …Run Code Online (Sandbox Code Playgroud) 我试图让mat-table排序在本地工作,虽然我可以按预期显示数据,但点击标题行不会像在线示例那样进行排序(根本不会发生任何事情).我试图让这个演示在本地工作:https
:
//material.angular.io/components/sort/overview https://plnkr.co/edit/XF5VxOSEBxMTd9Yb3ZLA?p=preview
我使用Angular CLI生成了一个新项目,然后按照以下步骤操作:https: //material.angular.io/guide/getting-started
这是我的本地文件:
app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { MatSort, MatTableModule } from '@angular/material';
import { AppComponent } from './app.component';
import { TableSortingExample } from './table-sorting-example';
@NgModule({
declarations: [
AppComponent,
TableSortingExample,
MatSort
],
imports: [
BrowserModule,
MatTableModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Run Code Online (Sandbox Code Playgroud)
app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: …Run Code Online (Sandbox Code Playgroud) 我目前正在研究Angular 4项目的密码重置页面.我们使用Angular Material来创建对话框,但是,当客户端单击对话框时,它将自动关闭.有没有办法避免对话关闭,直到我们的代码端调用"关闭"功能?或者我应该如何创建一个不可关闭的模态?
我试图将此示例中的第一个设置为默认值:plunkr
收到以下错误:
Unhandled Promise rejection: Template parse errors:
TypeError: Cannot read property 'toUpperCase' of undefined ("dButtonToggleGroup">
<md-button-toggle [ERROR ->]*ngFor="let indicador of indicadores; #first = first" value="indicador.id" [checked]="first">
"): ng:///AppModule/HomeComponent.html@35:78
Parser Error: Unexpected token #, expected identifier, keyword, or string at column 31 in [let indicador of indicadores; #first = first] in ng:///AppModule/HomeComponent.html@35:78 (" <md-button-toggle *ngFor="let indicador of indicadores; #first = first" value="indicador.id" [ERROR ->][checked]="first">
<span>{{ indicado"): ng:///AppModule/HomeComponent.html@35:153
Run Code Online (Sandbox Code Playgroud)
怎么了??
角材料介绍找到了一个新的日期选取器组件在这里.
我希望此组件返回的日期格式为yyy-mm-dd,但我不确定这是如何完成的.通过搜索我发现$mdDateLocaleProvider可以使用,但我找不到使用它的例子.
有人能告诉我一个格式化返回日期的工作示例md-datepicker吗?
angular-material ×10
angular ×8
angularjs ×2
components ×1
dialog ×1
javascript ×1
localization ×1
modal-dialog ×1
momentjs ×1
refresh ×1