小编Ant*_*reš的帖子

角材料徽章位置

我正在尝试在菜单列表中实现有角度的材质标志。

是否可以将徽标放置在列表项的中央?

官方文件说:“默认情况下,徽章将放置在之后的上方。可以通过定义属性matBadgePosition跟随其后的| below和after | after来更改方向。”

但是我需要排除此|在以下位置选项

在此处输入图片说明

或至少可以将整个徽章设置为可见

angular-material angular angular6 angular-material-6

5
推荐指数
1
解决办法
1379
查看次数

路由器导航到子路线-Angular 6

我已经定义了这样的路线:

const routes: Routes = [
    { path: '', loadChildren: './tabs/tabs.module#TabsPageModule' },
    { path: 'faq', loadChildren: './faq/faq.module#FaqPageModule' },
    { path: 'terms', loadChildren: './terms/terms.module#TermsPageModule' }
];
@NgModule({
    imports: [RouterModule.forRoot(routes)],
    exports: [RouterModule]
})
export class AppRoutingModule {}
Run Code Online (Sandbox Code Playgroud)

像这样:

const routes: Routes = [
  {
    path: 'tabs',
    component: TabsPage,
    children: [
      {
        path: '',
        redirectTo: '/tabs/(list:list)',
        pathMatch: 'full',
      },
      {
        path: 'list',
        outlet: 'list',
        component: ListPage
      },
      {
        path: 'profile',
        outlet: 'profile',
        component: ProfilePage,
        canActivate: [AuthGuardService]
      }
    ]
  },
  {
    path: '',
    redirectTo: …
Run Code Online (Sandbox Code Playgroud)

angular angular-router angular6 angular-routerlink

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

可选对象spring boot - 获取对象字段

我已经定义了客户实体

@Entity
@Table(name = "customer")
public class Customer {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id")
    private Long id;
    @Column(name = "name")
    private String name;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
Run Code Online (Sandbox Code Playgroud)

和CrudRepository

public interface CustomerRepo extends CrudRepository<Customer, Long> {
}
Run Code Online (Sandbox Code Playgroud)

如果我使用CustomerRepo.findById方法来查找客户

@Autowired
CustomerRepo repo;

Optional<Customer> dbCustomer = repo.findById(id);
Run Code Online (Sandbox Code Playgroud)

我怎样才能得到该客户的名字.我当时不能使用getter.所以我感兴趣的是有没有使用可选的getter的解决方案,或者我需要使用其他方法来通过id查找Customer?

java jpa crud spring-boot

2
推荐指数
1
解决办法
6325
查看次数

无法在 Tomcat7 上运行 Spring Boot 2.0:“由于缺少 ServletWebServerFactory bean,无法启动 ServletWebServerApplicationContext。”

我需要在 tomcat 7 上运行我的 spring boot 2.0 应用程序

我收到这个错误

[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.0.0.RELEASE:run (default-cli) on project Demo: An exception occurred while running. null: InvocationTargetException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more …
Run Code Online (Sandbox Code Playgroud)

java spring maven tomcat7 spring-boot

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