我在文档中读过,该MatSnackBarConfig对象可能有一个data代表的属性
数据被注入子组件.
所以我想我可以在通过openFromComponent方法打开的自定义零食栏中使用这些数据.问题是我可以这样做吗?如果是,那我该怎么做?
在文档中提供了一个示例,假设我将openSnackBar方法修改为以下内容:
应用程序/小吃店组分-example.ts
openSnackBar() {
this.snackBar.openFromComponent(PizzaPartyComponent, {
duration: 500, data: {message: 'Hello World!'}
});
}
Run Code Online (Sandbox Code Playgroud)
现在,我怎样才能获得该data对象PizzaPartyComponent?我试图将它注入组件的构造函数,但无法解决.
//below code results in error
export class PizzaPartyComponent {
constructor(private data: any) {
console.log(data);
}
}
Run Code Online (Sandbox Code Playgroud) 我有3个函数返回CompletionStage.让我们说它们看起来像:
CompletionStage<A> funcA();
CompletionStage<B> funcB();
CompletionStage<C> funcC(A a, B b);
Run Code Online (Sandbox Code Playgroud)
现在我想写funcD回归的功能CompletionStage<C>.结果由funcC和来自两个funcA和来自的params 计算funcB.现在的问题是如何正确地做到这一点?
我阅读文档后的尝试看起来像这样,但我不确定它是否正确使用.问题是thenCombineAsync我收到后CompletionStage<CompletionStage<C>>,最后一行看起来像丑陋的解决方法,以提取适当的结果.可以做得更好吗?
CompletionStage<C> funcD() {
CompletionStage<B> completionStageB = funcB();
return funcA()
.thenCombineAsync(completionStageB, (a,b) -> funcC(a,b))
.thenComposeAsync(result -> result);
}
Run Code Online (Sandbox Code Playgroud)
我们假设方法的声明不能改变.
当我进入表数据编辑器(数据库选项卡 ->架构-> 选定架构 ->表->F4选定表)时,拥有 IntelliJ Ultimate / Datagrip,我可以通过以下方式向数据视图上方的输入字段提供“过滤条件”:从单元格的上下文菜单中选择“过滤依据”选项。但是,在应用不返回任何行的过滤条件后,我无法撤销它们,除非使用鼠标单击“时间”图标。
是否可以仅使用键盘来关注该输入字段或清除当前的过滤条件?
查看设置中的键盘映射,我无法得到任何有关如何到达那里的提示。
我在使用角度和角度材料框架的组件设计时遇到了一些问题。
一切都是基于一个mat-sidenav-container. sidenav 包含手风琴 - 可扩展的列表,比方说“类别”。每个扩展面板内都有一个项目选择列表。到目前为止,一切都很好。
在选择列表上方,我添加了一个mat-list包含一项的常规项。该项目包含标题和“全选”选项。对于“全选”实用程序,我使用了相关的可点击的mat-icon.
mat-icon一切似乎都运行良好,除了设置为时的情况check_box_outline。此类图标会导致水平滚动条出现在侧面导航中。看起来图标后面添加了一些空格,但我不明白为什么。它不会出现在其他图标上,也不会check_box_outline_blank出现indeterminate_check_box。
有谁知道到底是什么导致了这个错误以及如何防止滚动条出现?
我将相关代码和演示放在stackblitz 上(在app文件夹内)。我使代码尽可能简单只是为了演示这个问题。我将不胜感激任何帮助。
我是 SprinBoot 的新手,我编写了一个简单的应用程序,它有一个控制器类。但是当我尝试从浏览器点击该控制器时,它给出了 HTTP-404 错误。它仅在添加@ComponentScan注释以加载该控制器后才开始工作。
我的问题是,即使我正在使用@SpringBootApplication,为什么我需要添加@ComponentScan注释?它不应该做同样的事情吗?
POM文件
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test.springboottest</groupId>
<artifactId>springboot-test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>SpringBoot Test App</name>
<description>SpringBoot Test App</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<properties>
<java.version>1.8</java.version>
</properties>
</project>
Run Code Online (Sandbox Code Playgroud)
控制器 :
package com.test.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/test")
public class MyController {
@RequestMapping("/sayHello")
public String testRequest() {
return "hello";
}
}
Run Code Online (Sandbox Code Playgroud)
主要方法:
package com.test.springboottest;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication …Run Code Online (Sandbox Code Playgroud)