如何为选择表单设置表单验证,选项为角点2中的占位符

时间:2017-11-13 09:16:15

标签: html angularjs typescript

category.component.ts

export class CategoryComponent{
	public categories : any = [
	{	name: 'Hotel', type: 'Company'},
	{	name: 'School', type: 'Company'}
  ];
 }

category.html

<form name="addCategoryForm" class="addCategoryForm" #addCategoryForm="ngForm" novalidate>
    <div class="form-group">
    <label class="control-label">Category Type</label>
    <select  class="form-control" name="SelectCategory"  [(ngModel)]="selectcategory" #SelectCategory="ngModel"  required>
         <option>Category Type</option>
         <option *ngFor="let category of categories">{{category.name}}        </option>
    </select>
    <button [disabled]="!addCategoryForm.form.valid">Save</button>
    </div>
    </form>

如何在选择表单中设置占位符以及表单验证

0 个答案:

没有答案