Merge branch 'master' into development

This commit is contained in:
piratefinn 2018-03-12 17:36:27 +00:00
commit 0924388619
2 changed files with 7 additions and 4 deletions

View file

@ -85,13 +85,13 @@
</div> </div>
<div class="radio" *ngFor="let category of leftCategoryIdList, let i=index"> <div class="radio" *ngFor="let category of leftCategoryIdList, let i=index">
<input [value]="category" type="radio" name="radios" [(ngModel)]="categoryId"> <input [value]="category" type="radio" name="radios" [(ngModel)]="categoryId">
<label>{{ categoryNameList[i] }}</label> <label>{{ leftCategoryNameList[i] }}</label>
</div> </div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="radio" *ngFor="let category2 of rightCategoryIdList, let i=index"> <div class="radio" *ngFor="let category2 of rightCategoryIdList, let i=index">
<input [value]="category2" type="radio" name="radios" [(ngModel)]="categoryId"> <input [value]="category2" type="radio" name="radios" [(ngModel)]="categoryId">
<label>{{ categoryNameList[category2 - 1] }}</label> <label>{{ rightCategoryNameList[i] }}</label>
</div> </div>
</div> </div>
</div> </div>

View file

@ -44,7 +44,8 @@ export class AddDataComponent implements OnInit {
minDate: any; minDate: any;
leftCategoryIdList: number[] = []; leftCategoryIdList: number[] = [];
rightCategoryIdList: number[] = []; rightCategoryIdList: number[] = [];
categoryNameList: string[] = []; leftCategoryNameList: number[] = [];
rightCategoryNameList: number[] = [];
constructor( constructor(
private formBuilder: FormBuilder, private formBuilder: FormBuilder,
@ -90,10 +91,12 @@ export class AddDataComponent implements OnInit {
private setCategoryList(data: any) { private setCategoryList(data: any) {
let categoryIdList = Object.keys(data.ids).map(key => data.ids[key]); let categoryIdList = Object.keys(data.ids).map(key => data.ids[key]);
this.categoryNameList = Object.keys(data.names).map(key => data.names[key]); let categoryNameList = Object.keys(data.names).map(key => data.names[key]);
let halfLength = Math.floor(categoryIdList.length / 2); let halfLength = Math.floor(categoryIdList.length / 2);
this.leftCategoryIdList = categoryIdList.splice(0, halfLength); this.leftCategoryIdList = categoryIdList.splice(0, halfLength);
this.leftCategoryNameList = categoryNameList.splice(0, halfLength);
this.rightCategoryIdList = categoryIdList; this.rightCategoryIdList = categoryIdList;
this.rightCategoryNameList = categoryNameList;
} }
getMinDate() { getMinDate() {