Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
Angular8
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
Simhadri Guntreddi
Angular8
Commits
c6b80aff
Commit
c6b80aff
authored
Mar 27, 2020
by
Simhadri Guntreddi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Update Delete Operations
parent
4848f10c
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
11 deletions
+33
-11
home.component.css
src/app/home/home.component.css
+5
-4
home.component.html
src/app/home/home.component.html
+5
-2
home.component.ts
src/app/home/home.component.ts
+19
-2
user.ts
src/app/models/user.ts
+1
-0
auth.service.ts
src/app/services/auth.service.ts
+3
-3
No files found.
src/app/home/home.component.css
View file @
c6b80aff
button
{
background
:
rgb
(
1
,
29
,
51
);
background
:
rgb
(
247
,
250
,
246
);
border-color
:
transparent
;
color
:
r
osybrown
;
color
:
r
gb
(
56
,
32
,
32
)
;
cursor
:
pointer
;
}
#customers
{
...
...
@@ -13,11 +13,12 @@ button{
#customers
td
,
#customers
th
{
border
:
1px
solid
#ddd
;
padding
:
8px
;
color
:
whitesmoke
;
;
}
#customers
tr
:nth-child
(
even
)
{
background-color
:
#f2f2f2
;}
#customers
tr
:nth-child
{
background-color
:
#f2f2f2
;}
#customers
tr
:hover
{
background-color
:
#ddd
;}
#customers
tr
:hover
{
background-color
:
royalblue
;}
#customers
th
{
padding-top
:
12px
;
...
...
src/app/home/home.component.html
View file @
c6b80aff
...
...
@@ -4,7 +4,7 @@
</button>
</p>
<div
style=
"text-align:center"
>
<h1>
<h1
style=
"color: #FFF;"
>
Welcome {{name}}
</h1>
</div>
...
...
@@ -18,6 +18,7 @@
<th>
Password
</th>
<th>
Role
</th>
<th>
Description
</th>
<th>
ID
</th>
<th>
Action
</th>
</tr>
...
...
@@ -28,8 +29,9 @@
<td>
{{item.password}}
</td>
<td>
{{item.role}}
</td>
<td>
{{item.description}}
</td>
<td>
{{item.id}}
</td>
<td><a
(
click
)="
getData
(
item
)"
><i
class=
'fas fa-edit'
style=
'font-size:24px'
></i>
</a>
<a
(
click
)="
deleteData
(
item
)"
><i
class=
'fas fa-trash-alt'
style=
'font-size:24px'
></i></a>
<a
(
click
)="
deleteData
(
item
.
id
)"
><i
class=
'fas fa-trash-alt'
style=
'font-size:24px'
></i></a>
</td>
</tr>
</ng-container>
...
...
@@ -41,6 +43,7 @@
<h2
class=
"login-header"
>
Update
</h2>
<form
[
formGroup
]="
userUpdateForm
"
class=
"login-container"
(
ngSubmit
)="
update
()"
>
<p
[
ngClass
]="{
'
has-error
'
:
isSubmitted
&&
formControls
.
userId
.
errors
}"
>
<input
type=
"text"
placeholder=
"userId"
formControlName=
"userId"
ngModel=
"{{userInfo.userId}}"
disabled
>
</p>
...
...
src/app/home/home.component.ts
View file @
c6b80aff
...
...
@@ -20,6 +20,11 @@ export class HomeComponent implements OnInit {
showMsg
=
false
;
userUpdateForm
:
FormGroup
;
isSubmitted
:
boolean
;
code
:
any
;
showModal
:
boolean
=
false
;
successMsg
:
any
;
taskTitle
:
any
;
deleteCheckModal
:
boolean
=
false
;
constructor
(
private
authService
:
AuthService
,
private
router
:
Router
,
private
formBuilder
:
FormBuilder
)
{
}
ngOnInit
()
{
...
...
@@ -46,8 +51,20 @@ export class HomeComponent implements OnInit {
this
.
showData
=
true
;
this
.
userInfo
=
data
;
}
deleteData
(
data
)
{
console
.
log
(
data
);
taskId
:
any
dat
:
any
=
{};
deleteData
(
id
):
void
{
console
.
log
(
id
);
this
.
taskId
=
id
;
this
.
authService
.
deleteData
(
this
.
taskId
).
subscribe
(
dat
=>
{
this
.
showModal
=
true
;
window
.
location
.
reload
();
},
error
=>
{
console
.
log
(
"error"
,
error
);
});
}
logout
()
{
this
.
authService
.
logout
();
...
...
src/app/models/user.ts
View file @
c6b80aff
export
interface
User
{
id
:
string
;
userId
:
bigint
;
email
:
string
;
password
:
string
;
...
...
src/app/services/auth.service.ts
View file @
c6b80aff
...
...
@@ -25,8 +25,8 @@ export class AuthService {
return
this
.
http
.
get
(
this
.
baseUrl
+
'users'
);
}
public
deleteData
():
Observable
<
any
>
{
return
this
.
http
.
get
(
this
.
baseUrl
+
'users'
);
public
deleteData
(
taskId
):
Observable
<
any
>
{
return
this
.
http
.
delete
(
this
.
baseUrl
+
'delete/'
+
taskId
);
}
public
isLoggedIn
()
{
return
localStorage
.
getItem
(
'token'
)
!==
null
;
...
...
@@ -38,7 +38,7 @@ export class AuthService {
}
public
update
(
userInfo
:
User
):
Observable
<
any
>
{
return
this
.
http
.
p
os
t
(
this
.
baseUrl
+
'update'
,
userInfo
);
return
this
.
http
.
p
u
t
(
this
.
baseUrl
+
'update'
,
userInfo
);
}
}
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