本文大纲
angular实战项目已完成,在此记录一个简单的RadioGroup和CheckboxGroup组件实现。完了下一步就该进入vue的学习和实战了。
父组件:
模板:parent.component.html
代码折叠
代码展开
1 | <form [formGroup]="try" style="border:1px solid #333;margin:0 50px;"> |
TS:parent.component.ts
代码折叠
代码展开
1 | import { Component, OnInit } from '@angular/core'; |
checkbox-group组件:
模板:checkbox-group.component.html
代码折叠
代码展开
1 | <label *ngFor="let e of options"> |
TS:checkbox-group.component.ts
代码折叠
代码展开
1 | import { Component, OnInit, Input, Output, forwardRef, EventEmitter } from '@angular/core'; |
radiobtn-group组件:
模板:radiobtn-group.component.html
代码折叠
代码展开
1 | <label *ngFor="let e of options"> |
Ts:radiobtn-group.component.ts
代码折叠
代码展开
1 | import { Component, OnInit, Input, Output, forwardRef, EventEmitter } from '@angular/core'; |