我想使用Angular创建一个多选嵌套下拉菜单。与此类似:
https://codepen.io/sathomas/pen/VpJeEo(请参见“搜索多个”示例)
html:
<nested-select options="vm.populations" placeholder="Search items" label="Permanently Open"
multiple collapsible fixed-menu allow-select-all></nested-select>
控制器:
angular.module('myApp', ['ngSanitize','ngMaterial', 'ngMdIcons'])
.controller('myCtrl', [function myCtrl () {
var vm = this;
// static collection for test/demo
vm.populations = [
{ text: "Item 1" },
{ text: "Item 2",
children: [
{ text: "Item 2.1" }
]
},
{ text: "Item 3",
children: [
{ text: "Item 3.1",
children: [
{ text: "Item 3.1.1",
children: [
{ text: "Yet Another Item 3.1.1.1" }
]
},
{ text: "Item 3.1.2" }
]
},
{ text: "Item 3.2",
children: [
{ text: "Item 3.2.1" },
{ text: "Item 3.2.2" }
]
},
{ text: "Item 3.3" }
]
}
];
}])
但是上面的代码是使用angularJs完成的。是否有Angular实现来做到这一点?我看过材质库,但是没有示例包含嵌套的多个可选项目。 https://material.angular.io/components/select/examples