AngularMaterial组件列表未报告初始选择
创始人
2024-10-28 12:00:52
0

在 Angular Material 组件列表中,发现在早期版本中初始化时的选择不会被报告。这可能会给开发人员带来困扰,然而,这个问题已经在后来的版本中得到了修复。

解决方法可以是升级版本,或者在代码中加入“ngAfterViewInit”来设置初始选择。下面是代码示例:

import { Component, ViewChild, AfterViewInit } from '@angular/core';
import { MatSelectionList } from '@angular/material/list';

@Component({
  selector: 'app-your-component',
  templateUrl: './your-component.component.html',
  styleUrls: ['./your-component.component.scss']
})
export class YourComponentComponent implements AfterViewInit {
  @ViewChild(MatSelectionList) selectionList: MatSelectionList;

  ngAfterViewInit(): void {
    this.selectionList.selectedOptions.selected.forEach(item => {
      console.log(item.value);  // 初始选择
    });
  }
}

相关内容

热门资讯

透视有挂!aapoker安装包... 透视有挂!aapoker安装包怎么使用(透视)脚本(总是存在有挂)暗藏猫腻,小编详细说明aapoke...
透视好牌!aapoker辅助器... 透视好牌!aapoker辅助器是真的吗(透视)透视方法(一直是有挂)1、aapoker辅助器是真的吗...
透视app!aapoker发牌... 透视app!aapoker发牌逻辑(透视)透视脚本下载(果然真的是有挂)1、游戏颠覆性的策略玩法,独...
透视规律!aapoker怎么提... 透视规律!aapoker怎么提高中牌率(透视)插件下载(真是是真的有挂)1、不需要AI权限,帮助你快...
透视辅助!aapoker怎么设... 透视辅助!aapoker怎么设置提高好牌几率(透视)免费透视脚本(竟然真的是有挂)1、该软件可以轻松...
透视游戏!aapoker辅助软... 透视游戏!aapoker辅助软件合法吗(透视)插件(一贯是真的有挂)1、aapoker辅助软件合法吗...
透视好牌!aapoker万能辅... 透视好牌!aapoker万能辅助器(透视)免费透视脚本(一贯是真的有挂)1、首先打开aapoker万...
透视透视挂!aapoker真的... 透视透视挂!aapoker真的假的(透视)辅助插件工具(真是是有挂)1)aapoker真的假的辅助挂...
透视脚本!aa poker辅助... 透视脚本!aa poker辅助(透视)万能辅助器(其实有挂);1、下载好aa poker辅助辅助软件...
透视好友!aapoker插件下... 透视好友!aapoker插件下载(透视)透视脚本入口(一直真的有挂);1、玩家可以在aapoker插...