import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; const init_options = [{ value: 'zhejiang', label: 'Zhejiang', children: [{ value: 'hangzhou', label: 'Hangzhou', children: [{ value: 'xihu', label: 'West Lake', isLeaf: true }], }, { value: 'ningbo', label: 'Ningbo', isLeaf: true }], }, { value: 'jiangsu', label: 'Jiangsu', children: [{ value: 'nanjing', label: 'Nanjing', children: [{ value: 'zhonghuamen', label: 'Zhong Hua Men', isLeaf: true }], }], }]; @Component({ selector: 'cm-cascader-doc-10', templateUrl: './cascader-doc-10.component.html', styleUrls: ['./cascader-doc-10.component.css'] }) export class CascaderDoc10Component implements OnInit{ _options:any = null; _value: any[] = null; _form: FormGroup; _console(value:any) { console.log(value); } constructor(private _fb: FormBuilder) { this._createForm(); } ngOnInit() { this._options = init_options; } _createForm() { this._form = this._fb.group({ name: [null, Validators.required ] }); } _reset(): void { this._form.reset(); } }