Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
single-page-application
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Christopher Cottier
single-page-application
Commits
ff56f46f
Commit
ff56f46f
authored
Apr 21, 2021
by
ccottier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
friendly validations added
parent
cdd25a01
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
7 deletions
+17
-7
contact-us.component.html
src/app/contact-us/contact-us.component.html
+7
-3
contact-us.component.ts
src/app/contact-us/contact-us.component.ts
+10
-4
No files found.
src/app/contact-us/contact-us.component.html
View file @
ff56f46f
...
...
@@ -22,9 +22,13 @@
</div>
</form>
<div
>
<ngb-alert
*
ngIf=
"showMessage"
type=
"danger"
>
{{ invalidEntry }}
</ngb-alert>
<
div
class=
"invalid-text"
*
ngIf=
"show
Message"
>
<ngb-alert
*
ngIf=
"show
Invalid
Message"
type=
"danger"
>
{{ invalidEntry }}
</ngb-alert>
<
!-- <div class= "invalid-text" *ngIf="showInvalid
Message">
{{invalidEntry}}
</div>
</div> -->
<ngb-alert
*
ngIf=
"showValidMessage"
type=
"success"
>
{{ validEntry }}
</ngb-alert>
<!-- <div class= "valid-text" *ngIf="showValidMessage">
{{validEntry}}
</div> -->
</div>
</div>
\ No newline at end of file
src/app/contact-us/contact-us.component.ts
View file @
ff56f46f
...
...
@@ -9,8 +9,12 @@ import { Component, OnInit } from '@angular/core';
export
class
ContactUsComponent
implements
OnInit
{
public
userForm
;
public
showMessage
:
boolean
=
false
;
public
invalidEntry
=
'Invalid entry'
;
public
showInvalidMessage
:
boolean
=
false
;
public
invalidEntry
=
'Invalid entry!'
;
public
showValidMessage
:
boolean
=
false
;
public
validEntry
=
'Valid Entry!'
constructor
(
private
formBuilder
:
FormBuilder
)
{
}
ngOnInit
():
void
{
...
...
@@ -24,9 +28,11 @@ export class ContactUsComponent implements OnInit {
onSubmit
(){
if
(
this
.
userForm
.
valid
){
alert
(
'User form is valid!!'
)
this
.
showInvalidMessage
=
false
;
this
.
showValidMessage
=
true
;
}
else
{
alert
(
'User form is not valid!!'
)
this
.
showInvalidMessage
=
true
;
this
.
showValidMessage
=
false
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment