小编Edr*_*ric的帖子

如何更改活动标签的墨盒颜色?

是否可以更改活动标签的墨盒颜色?

默认情况下,墨水条为蓝色.请看这里的例子.

我在SCSS中尝试了这个,但它不起作用.

.mat-tab-label-container{
  .mat-tab-list{
    .mat-ink-bar {
      background-color: green
    }
  }
}

.mat-tab-label-active{
 color: green 
}
Run Code Online (Sandbox Code Playgroud)

有人可以帮忙,

angular-material angular-material2 angular

6
推荐指数
1
解决办法
9307
查看次数

Angular 5 - 如何在组件初始化后重新加载组件

我在应用程序中有一个搜索功能.当用户点击搜索按钮时,数据在[(ngModel)]中被捕获并传递给服务,URL被重定向到搜索组件的html.该服务被注入"搜索"组件并显示数据.

现在,当用户输入新的搜索词时,我想刷新现有的搜索组件.这样做的正确方法是什么?

search.component.ts

import { Component, OnInit } from '@angular/core';
import { DataService } from '../service/data.service';

@Component({
selector: 'app-search',
templateUrl: './search.component.html',
styleUrls: ['./search.component.css']
})
export class SearchComponent implements OnInit {

userInput : string; 
constructor(private data : DataService) { }

ngOnInit(){
    this.search();
}

search(){

    this.userInput = this.data.searchData;
    console.log('in search init  ' + this.userInput);
    this.data.searchData = "";
 }
}
Run Code Online (Sandbox Code Playgroud)

app.component.ts

import { Component } from '@angular/core';
import { DataService } from './service/data.service';


@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})



export class …
Run Code Online (Sandbox Code Playgroud)

angular

6
推荐指数
1
解决办法
1万
查看次数

将自定义boxshadow添加到Flutter卡

我在Flutter应用程序中实现了卡片.BoxShadow每张卡都需要一个自定义.如何才能做到这一点?

到目前为止我尝试过的是将BoxShadow属性添加到Card()构造函数中,这不起作用...

android dart flutter

6
推荐指数
4
解决办法
1万
查看次数

如何从被调用组件内部访问 MatDialogConfig?

我在 spa 中使用 MatDialog,需要将 MatDialogConfig 传递给已调用的组件。有什么办法吗?

angular-material2 angular

6
推荐指数
1
解决办法
9450
查看次数

带多个动作的角形材质小吃店

Angular Material小吃栏中可以有多个动作吗?

我知道可以为小吃店使用您自己的组件。

但是对于此代码,该动作只是一个动作

private snackBar: MatSnackBar;


this.snackBar._openedSnackBarRef.onAction().subscribe(
  () => {
    console.log('action has occurd, but wich one?')
  }
);
Run Code Online (Sandbox Code Playgroud)

angular-material angular

6
推荐指数
2
解决办法
3286
查看次数

将角度材质菜单默认为打开状态

我在工具栏中有一个标准的 Angular Material Menu...

    <button mat-icon-button #videoMenu #menuTrigger="matMenuTrigger" [matMenuTriggerFor]="vidmenu" matTooltip="Watch videos" class="toolbar-btn"
(click)="onShowVid()">
    <mat-icon [style.color]=vidIconColor [style.background-color]=vidIconBackcolor>local_movies</mat-icon>
</button>
&emsp;
<mat-menu #vidmenu="matMenu">
    <button mat-menu-item>
        <img src="assets/images/vid_welcome.jpg" height=40px/>
        <span> Welcome</span>
    </button>
    <button mat-menu-item>
            <img src="assets/images/vid_video1.jpg" height=40px/>
            <span>Video 1</span>
        </button>
    <button mat-menu-item>
        <img src="assets/images/vid_video2.jpg" height=40px/>
        <span>Video 2</span>
    </button>
</mat-menu> 
Run Code Online (Sandbox Code Playgroud)

在测试中,无论我们制作多大的材质菜单图标,用户都看不到它。一位用户建议我们在打开菜单的情况下开始体验……这样他们就可以看到选项,点击一个,然后菜单关闭。然后他们就会知道它在那里供将来使用。

我已经研究过在 ngOnInit() 期间远程触发 click() 以打开它,但所有示例都是旧的 angular 版本,即使我让它工作,我猜它也会有问题。

有没有办法简单地将菜单设置为“打开”的默认状态,然后从那里正常运行?

angular-material angular5

6
推荐指数
1
解决办法
693
查看次数

角材料组件不起作用:'mat-option'不是一个已知元素

我正在尝试添加角形材质组件。但该组件无法正常工作。该错误说

Uncaught Error: Template parse errors: 'mat-option' is not a known element:
// ...
Run Code Online (Sandbox Code Playgroud)

我认为错误来自app.module.ts

Uncaught Error: Template parse errors: 'mat-option' is not a known element:
// ...
Run Code Online (Sandbox Code Playgroud)

typescript angular-material angular angular6

6
推荐指数
1
解决办法
8710
查看次数

Angular Reactive Forms - 实现输入组件包装器的最佳方式?

我试图解决的任务:

创建可重复使用的输入组件包装器,以节省编写表单模板时的时间。

我的意思的例子:

而不必编写以下模板:

<form [formGroup]="myForm">
  <mat-form-field>
    <input matInput placeholder="Email" [formControl]="email" required>
    <mat-error *ngIf="email.invalid">{{getErrorMessage()}}</mat-error>
  </mat-form-field> 
<form>
Run Code Online (Sandbox Code Playgroud)

我想写:

<form [formGroup]="myForm">
    <my-input-component [form]="myForm" [myFormControl]="email" [myFormControlName]="'email'" [label]="'Email'"></my-input-component>
</form>
Run Code Online (Sandbox Code Playgroud)

我的输入组件看起来像:

<mat-form-field [formGroup]="form">
    <input
        matInput
        type="text"
        [attr.inputmode]="inputMode"
        [placeholder]="label"
        [formControlName]="myFormControlName"
    />
    <mat-error class="errors" *ngIf="myFormControl.invalid">
        <div>{{ getError() }}</div>
    </mat-error>
</mat-form-field>
Run Code Online (Sandbox Code Playgroud)

这是按原样工作的,但我不知道这是否是将 FormGroup 和 FormControls 作为绑定传递的好方法。

在网上搜索后,我不断遇到NG_CONTROL_VALUE_ACCESSOR,并且有点困惑是否可以或应该在我的场景中使用它。

我不打算让这些组件成为“自定义”,即使用滑块作为表单控件或类似性质的东西,而只是希望“包装器”来节省一些时间。

任何有关该主题的建议或建议将不胜感激!

angular-material angular angular-reactive-forms

6
推荐指数
1
解决办法
4819
查看次数

为什么 Intent.EXTRA_INITIAL_INTENTS 在 android 10 中不起作用

我正在尝试分享一些文字,在 Android 10 中总是在我的手机中显示最多 3 个应用程序有 WhatsApp 但这里没有显示

此代码在 10 台以下设备中正常工作,但找不到在 android 10 中被过滤掉的原因。

fun onShareClick() {
        val intentShareList = ArrayList<Intent>()
        val shareIntent = Intent()
        shareIntent.action = Intent.ACTION_SEND
        shareIntent.type = "text/plain"
        val resolveInfoList = packageManager.queryIntentActivities(shareIntent, 0)
        for (resInfo in resolveInfoList) {
            val packageName = resInfo.activityInfo.packageName
            val name = resInfo.activityInfo.name
            if (packageName.contains("com.facebook") ||
                packageName.contains("com.twitter.android") ||
                packageName.contains("com.google.android.gm") ||
                packageName.contains("com.android.mms") ||
                packageName.contains("com.whatsapp")
            ) {
                val intent = Intent()
                intent.component = ComponentName(packageName, name)
                intent.action = Intent.ACTION_SEND
                intent.type = "text/plain"
                intent.putExtra(Intent.EXTRA_SUBJECT, "Your …
Run Code Online (Sandbox Code Playgroud)

android

6
推荐指数
1
解决办法
3568
查看次数

Material Color Tool 中的 Angular Material 自定义主题

Material.io 有一个很棒的工具,称为材质调色板生成器:https://material.io/design/color/#tools-for-picking-colors。使用它,您可以选择主要颜色和次要颜色,然后单击链接“在颜色工具中查看”,该链接会将您带到一个页面,您可以在其中以不同方式查看您的选择:https ://material.io/resources/color /#!/?view.left=0&view.right=0&primary.color=6002ee&secondary.color=c63131

但似乎没有一种简单的方法可以将调色板导出为可用于生成自定义 Angular Material 主题的格式。他们有一个导出链接,但最接近的格式似乎是 CodePen。但是一旦你在CodePen中打开它,CSS似乎没有你需要的调色板信息。

我的问题:有人尝试过这些工具吗?是否有从 Material 调色板到 Angular Material 自定义主题的预先建立的途径?或者说他们没有关系?如果不相关,是否有一种简单的方法将前者所需的颜色代码复制到后者?

谢谢。

material-design angular-material

6
推荐指数
1
解决办法
6962
查看次数