mirror of
https://github.com/richard-loafle/fuse-angular.git
synced 2025-04-18 14:22:35 +00:00
+ Navbar, Footer, Toolbar color options added to theme-options + FuseLayoutService moved to FuseConfigService
74 lines
1.8 KiB
TypeScript
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;
|
|
}
|
|
}
|
|
}
|
|
}
|