mustafahlvc 2eb9b3f09e FuseMaterialColorPicker enhanced
+ Navbar, Footer, Toolbar color options added to theme-options
+ FuseLayoutService moved to FuseConfigService
2017-08-22 13:45:07 +03:00

74 lines
1.8 KiB
TypeScript

import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { FuseConfigService } from '../../../../../core/services/config.service';
@Component({
selector: 'fuse-lock',
templateUrl: './lock.component.html',
styleUrls: ['./lock.component.scss']
})
export class FuseLockComponent implements OnInit
{
lockForm: FormGroup;
lockFormErrors: any;
constructor(
private fuseConfig: FuseConfigService,
private formBuilder: FormBuilder
)
{
this.fuseConfig.setSettings({
layout: {
navigation: 'none',
toolbar : 'none',
footer : 'none'
}
});
this.lockFormErrors = {
username: {},
password: {}
};
}
ngOnInit()
{
this.lockForm = this.formBuilder.group({
username: [
{
value : 'Katherine',
disabled: true
}, Validators.required
],
password: ['', Validators.required]
});
this.lockForm.valueChanges.subscribe(() => {
this.onLockFormValuesChanged();
});
}
onLockFormValuesChanged()
{
for ( const field in this.lockFormErrors )
{
if ( this.lockFormErrors.hasOwnProperty(field) )
{
continue;
}
// Clear previous errors
this.lockFormErrors[field] = {};
// Get the control
const control = this.lockForm.get(field);
if ( control && control.dirty && !control.valid )
{
this.lockFormErrors[field] = control.errors;
}
}
}
}