TRANSCRIPTEnglish

College Project Competition Registration App Angular 19 | Angular Project

1h 41m 39s15,737 words2,339 segmentsEnglish

FULL TRANSCRIPT

0:00

Hello all, welcome back to learning

0:01

partners. If you are new, please do

0:03

subscribe. This is another channel where

0:05

you can directly connect with me. We

0:07

have around thousand plus members

0:08

already who are working. We take live

0:10

coding sessions and everything. To just

0:12

get notified about those session, please

0:13

do join this

0:16

group. So in this video we are going to

0:18

complete a small project that will be

0:20

let's say a project competition website.

0:22

It's a website but it has API

0:24

integration and everything. Let's say uh

0:27

any uh what do we say committee or any

0:30

college is there which organize some

0:32

events over the time right various

0:34

different uh project competition or some

0:36

paper writing or something it can be

0:38

anything they organize them some project

0:40

competition or event competition

0:42

something right so they need a website

0:44

where they will showcase like what are

0:45

the ongoing competitions they have right

0:48

and they student can register to their

0:50

website and they can participate in that

0:52

ongoing competition so this is the whole

0:53

flow so there are two types of login one

0:56

is the college means who will they are

0:58

the organizer and another is the student

1:00

who will log in and participate in the

1:02

project so as I said like it's a website

1:04

so website should have a landing page so

1:06

this is our landing page here we will

1:08

show all the ongoing competitions and

1:11

just a basic information pass some

1:13

winners and anything right

1:16

then remaining things are let's say we

1:18

have a website landing page is there

1:20

then we have to show the competition

1:21

whatever going on this is like dynamic

1:23

with the API integration we have to go

1:24

we How to create the competition?

1:26

College will be creating competition.

1:28

Okay. Then we will have student

1:30

registration and the login page. Then

1:31

college login will be there. Login page

1:33

single same login page we will be using

1:35

but based on the role we will show some

1:37

details to the student some details to

1:39

the college. Then as student login we

1:42

will student will submit their project.

1:45

Then on the college login we have to

1:46

show the student list and competition

1:48

winner will be set by the college login

1:50

and will be visible to the student also.

1:53

The APIs which we are going to use it's

1:55

on the free API project free project

1:57

api.com. So this is the uh means you if

2:00

you go to the basic website this is the

2:02

main and you have to click on project

2:04

APIs all the project APIs are over here.

2:06

So project competition these are the

2:08

APIs which we are going to use. Okay

2:10

very few APIs are there. Now I have used

2:14

uh levelable AI tool just to create the

2:18

uh basic UI. So you can say this is the

2:21

again see uh so many guys are asking

2:23

like why I'm not providing the template.

2:26

You also has to uh get friendly with the

2:29

AI tool because this is the UI which I

2:32

have created by using the AI tool. So

2:34

you should also get familiar try to

2:35

create it. If not just contact me or my

2:38

team on the WhatsApp they will provide

2:40

you the template. So this is your

2:42

landing page where we will have some

2:44

basic information. Then we have this

2:46

registration page for the student.

2:47

College doesn't have to register that by

2:50

default login will be created for the

2:51

college login. So this is the first name

2:53

last name email address something

2:54

details are there. Then this will be our

2:57

login page. This is the dashboard page

3:00

of the college. Once uh college logged

3:03

in you will be able to see the uh

3:05

dashboard and same for the student also.

3:06

Some things will be hidden for college.

3:08

Some things will be showing to the

3:10

student login. Then this is how the

3:13

project submission form. So this is the

3:14

project submission form which we have.

3:16

From here student will uh participate in

3:19

the particular project and this is the

3:21

student list. Whatever the multiple

3:22

student have registered we just need to

3:24

show it to the college login. So this is

3:25

the list for that. This is the UI we

3:28

have. Now I have created a project of

3:30

angular 19. So how do we create the

3:32

project ng new then your project name.

3:34

Then it will ask you like what CSS

3:36

framework you need CSS last right. So

3:38

you need to CS select CSS. Then it will

3:41

ask you another u uh question like do

3:44

you need a server sign SSR enabled or

3:46

not? So you just have to say no. So once

3:48

I create the basic project so this is my

3:51

project. Okay. Again it's an empty

3:53

project only. I'm doing some things

3:54

parallelly because uh we I don't want to

3:57

waste the time over here. So once I have

4:00

created the basic project I have

4:01

installed bootstrap and the fontsome

4:02

because in my UI template I'm using

4:04

bootstrap and the fontsome. Then once

4:06

you install these entries of the

4:08

bootstrap and the fontasum will be added

4:09

to your package.json over here. Fine.

4:12

Then these are your third party

4:14

libraries. So to use it across the

4:16

application you need to add the entries

4:17

of the CSS into our angular.json. See in

4:20

the style section. So whatever the

4:22

external libraries you are using either

4:24

it's uh what do we say bootstrap or font

4:28

awesome or any third party library all

4:30

CSS we need to add it over here. Then if

4:32

you are going to use the JS so we have

4:34

to add an entry over here also in the

4:36

script section. Here I'm going to use

4:38

the bootstrap do.js because I have this

4:41

dropdown which will work fine if we use

4:43

the bootstrap

4:45

uh js.

4:46

Okay started now. So if you see these

4:50

are the multiple pages we have. So now

4:52

we have to create the component. Fine.

4:54

Now let me just go over here. Let's me

4:57

close it. So in app folder we will

5:00

create a pages folder.

5:02

basic architecture we will set up. So in

5:04

pages folder we will have all the

5:06

component which are going to be

5:07

connected with our route. Fine. So let's

5:10

open new

5:11

terminal. A new terminal will open on

5:13

that particular

5:15

folder. Ng

5:18

generate either you can

5:21

write full form

5:24

also then component. Let's say first is

5:27

like home component I'm creating. In

5:30

this home component, we will have our uh

5:32

what do we say the landing page. Fine.

5:34

Now bar we will keep it into our app

5:36

component and the remaining home uh

5:38

landing page UI will we will keep it in

5:40

the home component. Enter. So this will

5:42

create our component. So

5:46

as so home component is created. Now

5:49

after that we need to create the

5:50

remaining component. So either you can

5:52

write the full form of generate and

5:54

component or the you can go with the

5:55

shortcut also ng g component and then

5:58

let's say

6:00

register enter. So this will also create

6:02

the same component. Fine. So let me just

6:05

create remaining component. I'm just

6:06

pausing it for

6:09

now. Fine. So you can see I have created

6:11

all the component. Now in the pages

6:13

folder you can see whatever the

6:14

components I have created that are

6:15

visible over here. Now once you create

6:18

the component next thing should be you

6:19

have to create the routes as angular is

6:21

a single page application so we have to

6:23

create the routes. So when we create the

6:25

project by default we get app route.ts.

6:27

So in this file we have to create the

6:28

routes. So by default pre in previous

6:30

version this used to be a module but now

6:33

it's just a constant file. Here we are

6:35

creating the route and this route we

6:36

will be accessing into our app config

6:38

over here. Fine. Now let's create the

6:41

route. So as this is a website by

6:43

default particular page should default

6:46

be open right any web application what

6:49

we access by default some page will be

6:51

there so we will have a default route

6:53

over here so now route is nothing but an

6:57

object right so we have

6:59

path with empty redirect to if means URL

7:03

doesn't have anything where we have to

7:04

redirect so home and path m strategy we

7:08

have to specify full so this is my route

7:12

then we need to create another route

7:14

that will be home one so this is my

7:16

default route if we don't have anything

7:18

in the URL it will redirect to the home

7:20

route

7:21

component home

7:24

component fine like this I need to

7:27

create the remaining component

7:32

now fine so I have created all the

7:34

component right what are the components

7:36

we created all component routes I have

7:38

created fine now let's close this we are

7:41

done with this now as I said this is

7:44

kind of a website structure so this

7:45

navbar we will keep it into our app

7:47

component fine so this is my HTML so

7:51

let's go over here let's copy the nav

7:55

bar so this is my navbar this I need to

7:59

put it into my app

8:03

component and after app component we

8:05

need router outlet as well router outlet

8:08

is a directive which is responsible to

8:09

load the activated route component.

8:11

Fine. Now let's run this also. Terminal.

8:16

Let's open new terminal on the parent

8:19

folder. ng. So enter. So this will run

8:23

your

8:25

project. Let it

8:28

compile. It won't work because we are

8:30

going to need the CSS. Just let me run

8:36

first. So local

8:40

420. So you can see something is coming

8:44

right now is coming but it's not the CSS

8:46

is not getting applied because the CSS I

8:48

have it over here for that now bar. So

8:50

this is my global CSS the CSS which are

8:53

going to be need in all the pages. So I

8:55

will copy this and I need to put this

8:57

into my global CSS. So I have style dot

9:00

CSS. So here I will be putting it. Now

9:02

you can see we got the same nav bar what

9:05

was available over here.

9:07

Understood? So we got the nav bar. Now

9:09

in home component by default you can see

9:12

if I don't put anything

9:15

sorry still it is navigating to the home

9:18

component because we have created our

9:19

default route. Fine. Now in home

9:21

component what we are going to have the

9:23

remaining section of the landing

9:25

page means this remaining section of the

9:28

landing page will be going into the home

9:30

component. Fine. So let's get it. So

9:33

this hero

9:37

section let me just copy whole thing and

9:41

footer we will put it into our what do

9:43

we say app component fine so let's move

9:46

this first and I will put it into my

9:49

home

9:51

component let's save

9:54

it and let's check it so now you can see

9:58

images are not coming why okay now it is

10:00

coming fine so now you can see the

10:02

Homepage is currently coming. Okay.

10:06

Now, so we got the landing page ready

10:10

again like it's just a copy paste thing.

10:11

You can also either you use chat GPT

10:13

bold tool or loable or cursor any air

10:15

tool you can use and just provide the

10:17

prompt like create me a what we will say

10:20

create me a website landing page using

10:22

bootstrap for a college project

10:24

competition. So it will provide you

10:26

something like this. All a tool will be

10:28

providing you similar to something like

10:30

this. Okay. Obviously theming and

10:31

combination you need to specify what

10:33

color combination what icons you need

10:34

like that it will specify. Okay now so

10:37

our home home component is ready by

10:39

default landing page is ready. Now first

10:42

thing is like we need the lo we need to

10:45

complete the student registration page.

10:47

So if I click on the register I should

10:49

be able to navigate to the student

10:51

registration page. So we have this

10:53

navbar right. So in our

10:55

navbar let me close this. So now here

10:59

you can see we have got register button.

11:01

Okay. So if user is not logged in we are

11:04

going to show this right. So on click of

11:06

it you can see href is there but href we

11:08

cannot use it in angular right. So what

11:10

do we have in parallel to the href?

11:12

Router link right to navigate from one

11:14

component to another from the HTML we

11:16

use router link just like href. So here

11:19

we have to import that also router link.

11:21

Fine. Then over here router link and

11:25

where you have to navigate. So register

11:27

page. Let's get the route of register.

11:29

Whatever the route name you created,

11:30

this is our route name. This will go

11:32

over here just like that for the login

11:34

also I'm

11:38

doing

11:40

login. Fine. Let's just say event check

11:44

if we are able to navigate. So if I

11:45

click on register, you can see I'm able

11:48

to navigate and register component is

11:49

also loading. Now I need the register

11:51

UI. So this is my register UI. So this I

11:54

need copy. So again we will go to our

11:56

register page. Let's get the content. So

12:00

this is my form. Let's copy. Now this UI

12:03

will go to my register

12:06

component. Let's

12:09

save. Now you can see register page our

12:12

form is coming fine. Now so here on

12:16

click of register we need to integrate

12:17

the student registration API. Let's

12:20

check the API. So if you check out over

12:22

here here we will have register API fine

12:26

if you check the object we got wait we

12:29

got full name email password college

12:31

name and role but in my form I can see

12:34

so many

12:35

things how come I am able to see so many

12:38

things okay I think I didn't provided

12:42

the prompt to the lovable correctly but

12:44

still so we will remove the unnecessary

12:47

thing so in your form this is the object

12:50

what you need to send to the API. So

12:51

only these things should be there. Now

12:53

role is going to be managed by API. Even

12:57

if you send it or not, by default it is

12:58

going to be student because as I said

13:00

college is not going to get registered

13:02

because the hardcore login will be there

13:05

already created for the college. So we

13:07

just need four things over here. Full

13:10

name, email, password and the college

13:12

name. Let's remove the remaining thing.

13:13

We don't need all those

13:15

things. So first name and the email.

13:17

First name and the last name is not

13:19

there. So we have full name fine. So we

13:21

will say full name over here. We don't

13:25

need this. So this is the first. Then we

13:30

have email. So email will be there. Then

13:33

we need password. So college is not

13:35

there. So let's remove

13:37

it. Department phone number is also not

13:41

there. So let's remove it. I think some

13:42

fields are in the submit project. Fine.

13:45

And compon password also we don't need.

13:48

Then agree terms also we don't

13:51

need. Let's

13:54

save. Okay. So we got full name, email

13:57

address and the password. Only three

13:58

things are there. Let's see if it we are

14:01

missing anything. Okay. Sorry. College

14:02

name was there. We removed the college

14:04

[Music]

14:05

name where it

14:07

was. Okay. Let's use this over here.

14:13

Full name and then college name. Fine.

14:19

So you can see we got the full name,

14:21

college name, email id and the password.

14:23

Now on click of create account we have

14:24

to execute our we have to integrate our

14:26

this register API. Now we are moving

14:29

towards the API integration. Again we

14:30

have the form also. Now in angular we

14:33

have two types of form template form and

14:35

the reactive form. So I will start with

14:37

the basic then as we move ahead with the

14:39

different different component I will

14:41

slowly you start using the advanced

14:42

concept also. So for now I'm going with

14:44

the template form because that's easy to

14:46

understand and relative relative also.

14:49

Now we are using the template form. So

14:52

template form gets identified by using

14:55

ngmodel directive. So whatever the

14:57

things we have it over here we have to

14:58

integrate with the ngmodel directive

15:00

with our object. Now if you see the

15:02

object this is our object. So we need to

15:04

copy it and in our component ts we have

15:09

to create a variable. Let's say resistor

15:12

obj. I'm going with any for now. Again I

15:14

will be creating class interface but for

15:16

now I'm going with any. As I said I will

15:18

be going with very basic thing. So what

15:20

we did we created a variable and inside

15:22

that variable we have stored our object.

15:24

Fine. Let me remove

15:27

this. Now this object we need to bind to

15:31

our form. Let me close

15:38

everything. So this is the object which

15:40

we have created. Now this object we have

15:42

to bind to our form means not this

15:44

object particular field. So we have to

15:47

use ngmodel for that. So if you are

15:49

going to use ngmodel you have to import

15:51

forms module into the component itself

15:54

like this. Okay. Then this object you

15:57

need to bind to all the input element by

15:59

using ngmodel directive. Round bracket

16:01

square bracket ng model is equal to your

16:05

object dot what will be the field full

16:09

name. You need to bind it over here.

16:11

Okay, like this I will

16:13

copy. Then second is the college name.

16:16

So here this field I need to

16:19

bind. Let me

16:21

copy. So email

16:24

address and the password is there. Let's

16:26

bind the remaining field. Password will

16:28

go over here and email will go over

16:32

there. Role we are not going to do it in

16:34

the UI but by default we will send it as

16:36

empty. API is going to insert some data

16:38

to into the role. by default student. So

16:40

it doesn't matter if you send it or not

16:42

but because API is going to handle that.

16:44

So we created object that object we have

16:45

binded to the form by using ngmold

16:47

directive we imported this. Let's save

16:49

and check if something is wrong over

16:52

there. As a UI developer now always your

16:54

console should be on. If I navigate to

16:57

the

17:00

register so if you check the console we

17:02

are getting an error. So error is if

17:04

ngmodel is within a form tag you need

17:06

name attribute present. So if you are

17:09

using ngmodel inside a form tag then

17:12

name attribute is also mandatory. So

17:14

this is like name attribute and whatever

17:16

the property you bind it over here same

17:18

you need to bind it. Okay let's quickly

17:21

copy paste and change the field

17:24

name

17:26

here password will

17:28

go email and college name. If I

17:33

save see now we don't have error. Okay.

17:37

Something else is there. Hash first

17:39

[Music]

17:40

name I think two. Yeah. Yeah. So you can

17:43

see we have two element with the same

17:45

ID. That's why we got the warning. Okay.

17:47

Now we can ignore that or let's change

17:50

it

17:57

also.

17:59

Okay. Now so on click of create account

18:02

we need to integrate our API. Now we are

18:04

moving towards the API integration. So

18:06

in angular if you have to integrate the

18:08

API what you need to do is first you

18:12

need to go to our app config. First of

18:13

all in angular we do the API call by

18:15

using fetch API also which is directly

18:17

from the javascript or angular itself

18:19

has a library that is http client to

18:21

make the API call. So in app config we

18:24

need to add provide http client

18:27

instance. So

18:31

provide http client. This is what you

18:34

need to add. It's an array right? You

18:36

can see provide change detection is

18:38

there provider router and provider HTTP

18:40

client. This is what we have added. So

18:42

whenever you have to make the API call

18:43

first thing you do is pro you need in

18:45

provider sorry you need to add provide

18:47

HTTP client. Fine. Now let's close it.

18:50

Now we can make the API call. So for now

18:52

as I say I'm going with the basic. So

18:55

now we can create the service also but

18:57

for now I'm creating API call into my

18:59

component only. From component only I

19:00

will be triggering the API call now. So

19:03

we have to inject our HTTP client

19:05

service. Okay, how do we do that? So

19:08

HTTP is equal to inject and then we

19:12

register HTTP client service over here.

19:15

So this is how we have created the

19:16

instance of our HTTP client service. Now

19:18

we need a function on

19:22

register. Fine. Now from this function

19:24

we are going to make the API call. So

19:27

this http dot post API call it is if you

19:32

check the swagger documentation see the

19:35

method of the API is post fine. So post

19:37

API. Now we need the URL. Let's just get

19:40

the URL. So this is my

19:43

URL. This URL will go over here as the

19:46

first parameter. Okay. Now let me close

19:49

this so that we can see properly. Post

19:52

API need two parameter. first URL and

19:54

what object you need to store post API

19:56

normally we use to create new object

19:58

into the database to insert new data

20:00

into the database. So obviously this is

20:02

your URL. So what data you need to

20:03

insert. So we need the second object

20:05

that is nothing but our second parameter

20:07

that is nothing but our object. So this

20:09

object we need to pass it over here. So

20:10

this dot like this then we can

20:14

subscribe. So subscribe is like this is

20:16

actually which is going to trigger this

20:18

piece of code. Okay.

20:21

subscribe

20:23

result colon any we are just going to

20:26

have the subscribe block error block I'm

20:28

not writing for now if API call is

20:30

success our subscribe block will execute

20:33

and here we will simply show the alert

20:34

box

20:36

like

20:38

student

20:42

registration success fine let's add a

20:46

debugger since we are making the for the

20:49

first time Let's add a debugger and

20:50

check it also

20:52

properly.

20:54

Okay, let's try integrating the API call

20:57

now. So let me show you the existing

20:59

data

21:00

also. If you see over here get all user.

21:03

Let's paste it. So currently you can see

21:07

I just have one record response. Okay.

21:09

Now we are going to register. Let's say

21:11

I'm registering with my

21:13

name college name let's say PC

21:16

something chithan at the rateg

21:20

gmail.com and password 1112233 something

21:24

password I'm passing okay again uh as I

21:27

said I'm going with basic uh form

21:29

validation if you know it you can have

21:31

that pattern also like minimum character

21:33

maximum alphabetical numerical like that

21:35

let's try to inspect now if I click on

21:39

create oh we forgot to to add the event.

21:42

See, we created this function, but we

21:44

didn't call this function on the create

21:45

button, right? So, we have this button

21:48

over here. We will call our function.

21:50

So, that will be click event and the

21:52

function name. Instead of submit, let's

21:54

go with input type button. Fine. Let's

21:58

save it and check it. Now, we have to

21:59

fill the form again. Let's do it

22:01

quickly.

22:04

So chithatan PC

22:07

email and password 11 1 22 33 3. Fine.

22:11

Now on click of create account you can

22:13

see our function got triggered. Now if I

22:16

use my mouse and hover on this see

22:18

whatever the data you filled into the

22:20

form that you got into the object

22:22

because this object we have binded to

22:24

that form. Correct. Now we are making

22:26

the API call.

22:27

Continue. Yeah we got the response. So

22:30

in the result you can see we got the

22:32

message like user registered

22:33

successfully means user is user has

22:35

successfully done the registration.

22:37

Fine. Now let's check the API again if

22:39

the data is inserted properly or not.

22:42

See user ID too. So whatever oh my god

22:45

role I think I forgot to pass it in the

22:49

API. As I said now role will be handled

22:51

by the API but I think it is not

22:53

happening. So what we will do now first

22:56

for now we will add the role as student

23:00

hardcoded anyway okay but by the time

23:03

you will check the API I will do that

23:05

change also you don't have to send it

23:07

even if you send it I will hardcode it

23:09

on the API side fine so student is able

23:12

to register now let's try the login also

23:15

so if you check the API after the user

23:18

registration you have immediately login

23:20

API for the login API what you need to

23:22

send email and the password again post

23:24

API integration because we have to send

23:26

the object right

23:29

now we have to go to the login

23:32

registration component work is done so

23:33

I'm closing this component now we have

23:35

to go to the login component now again

23:38

login UI is there correct so let's go to

23:41

the

23:42

HTML let's get the login

23:45

component this is my form let's copy it

23:49

and this will go to my login

23:51

HTML fine let's try to navigate and see

23:54

if the login component is coming

23:56

properly or not. Yeah, you can see login

23:59

component is coming properly. Now on

24:01

click of sign in we have to integrate

24:03

our login API. Now in the registration

24:05

API we have done the template. Now here

24:06

we will go for the reactive. So as I

24:08

said moving step by step I will move I

24:10

will be moving to the advanced part so

24:11

that we can use all the concept whatever

24:14

the concept you might have done from the

24:15

tutorial. All concept we have to use

24:17

while working on a project. That's how

24:19

you increase your knowledge. Okay. Make

24:22

sure whenever you are doing the project

24:24

now don't use template form at all the

24:26

time. Sometimes go for a reactive even

24:29

sometimes try the dynamic form. Try to

24:31

create the dynamic form reading the JSON

24:33

or something. Always go one step ahead.

24:36

Okay. Now so again this is the object

24:39

what we need to send. So for this we

24:41

have to create the reactive form. Okay.

24:43

Now how do we create the reactive form?

24:45

So first if you have to use ngmodel you

24:48

need to import the forms model. If you

24:50

are going to use reactive form, so you

24:51

need to import reactive form module.

24:53

This is the first thing.

24:55

Then login form

24:59

colon form group. We have to create is

25:01

equal to new form group round bracket

25:04

curly bracket. Okay, this is how we

25:06

create the reactive form. Now what are

25:08

the controls we have? Properties we need

25:09

to send that will be nothing but our

25:11

control. So email colon new form control

25:16

we will initialize with empty. Fine.

25:19

Then second control will be our

25:20

password. So let's

25:22

copy password again new form

25:26

control like this. So we have created

25:28

our reactive form. Now there are two

25:30

ways to create the reactive form. First

25:32

by using form group and second by using

25:33

form builder also. Okay. So make sure

25:36

again you also while practicing

25:37

sometimes go for form group, sometimes

25:39

go for a uh that service also form

25:41

builder. So we created for this form.

25:43

Now this form we need to bind to our

25:45

login form. Let's open it side by side.

25:50

Now in reactive form whatever the form

25:52

name you have created this form name you

25:54

need to bind it to your form group by

25:56

using form group

25:58

attribute over here like this. So this

26:01

form name you have binded to your form

26:03

tag. Then whatever the elements you have

26:06

so email address. So here you need to

26:08

bind form controller name is equal to

26:11

then your control name. Control name is

26:13

email. So you already specified this is

26:15

my form. So it will going to find this

26:17

control is there or not like this. Then

26:20

on it

26:23

password here password will go fine. So

26:28

we created a template for reactive form

26:29

and that form we have binded. Now we

26:32

don't need this remember. So let's

26:34

remove

26:37

it. Now on click of sign in one more

26:40

thing. So some as I say like we should

26:43

go for input type button but we can go

26:44

for input type submit also but if your

26:46

button type is submit on the form level

26:48

you can write the events. So that

26:56

is so that will be on sub submit event.

27:01

Okay. Now on click of submit we have to

27:03

write our

27:05

event. So this will be our function.

27:12

Okay. So on click of submit button this

27:14

function will trigger. Okay. Now as I

27:16

said in the registration we have done

27:18

the API call from our component only.

27:20

But now we will create the service. So

27:21

instead of writing the API call into

27:23

your component directly now we will be

27:25

creating our service. Fine. Let's create

27:28

a service first. So in app in folder we

27:31

have just created a pages folder. Now in

27:33

app folder I'm going to create one more

27:34

folder that will be to store the

27:36

services.

27:38

services fine now in services folder I

27:41

need to create my first service that

27:42

will be our let's say user service ng

27:45

generate service and

27:50

user fine so this is my user service got

27:53

created let me show you see this is what

27:56

service looks like okay above the class

27:58

you can see this is my decorator if you

28:00

open any component above the class you

28:02

can see this is component decorator this

28:03

is injectable decorator means service so

28:06

these are various types decorator. This

28:08

is a class decorator. Again, so many

28:10

decorators are there. We will see

28:11

whatever we are going to use now. So

28:14

instead of doing the API call into

28:16

component, we can do the API call

28:18

function into our service also. That's

28:19

the best way because our component

28:23

should not have what do we say any

28:26

complex logic component should be only

28:28

responsible to do the manipulation or

28:31

the uh dom manipulation of your HTML

28:33

template your services logic some

28:36

utility function whatever the logic you

28:38

have that should move to your service

28:40

okay that's what like that single

28:43

responsible uh single responsibility

28:45

principle we have to follow from the

28:46

solid right so now Now in service we

28:50

have to inject our HTTP service. So I

28:52

can do private http colon http client.

28:56

So this is the old way how we used to

28:58

inject the service from angular 16 we

29:00

got that inject but this is also

29:01

possible. Now

29:03

on user login a function I'm creating

29:08

now from this function whenever I'm

29:09

calling this function from my component

29:11

I'm going to pass the object right. We

29:14

need to pass the login object. Huh? What

29:15

user id and the password we email and

29:17

the password we are going to pass. So we

29:19

need to catch that over here. So obj

29:21

colon any again I'm going with any but

29:23

in the next component I will be creating

29:25

class and interface. Now return this

29:29

dohttp dot post api call. Again it's a

29:32

post API call only. Now let's get the

29:34

URL. Now the URL will be almost same

29:37

just method name will get changed. So

29:39

from register we will copy this

29:42

URL. So this will be

29:46

constant. Then just login my method name

29:49

for

29:50

the we need to

29:55

change. Okay. Now as I said first APN

29:59

needs to object. This is the URL and

30:01

second is the object. So this function

30:03

is going to make the API call and

30:05

whatever the response we get that is

30:07

going to return. Fine. Now we have

30:09

created our service. Now this service we

30:11

need to inject into our login component.

30:14

Right? So over

30:18

here

30:20

user

30:24

service inject what we need to inject

30:26

our user

30:27

service this one. Okay. Now here this

30:31

dot user service dot currently we just

30:33

have one function. This function needs

30:35

the parameter. Now here we don't have

30:37

the object we have the form. So we have

30:40

to extract the object from it. So

30:42

constant form value is equal to this dot

30:45

login form dot value. Now you will get

30:48

the object from this and this object we

30:50

need to pass it over

30:52

here. Dot subscribe

30:56

sorry dots subscribe round

31:01

bracket. Now there is something new.

31:06

Sorry, let me

31:12

just set

31:14

next

31:23

colon. Just write the syntax. Wait,

31:26

wait, wait. Something is wrong. I'm

31:28

trying to find the I'm trying to find

31:30

the another syntax. What we have got

31:33

next.

31:39

Sorry. Round

31:41

bracket. Okay. Now here we can

31:44

have next

31:54

something I'm missing. Subscribe. We

31:56

have done. Let me write it one more

31:59

time. I I'm not used to that another

32:01

syntax. Subscribe. We will do.

32:06

[Music]

32:15

Wait, wait, wait. So this function is

32:18

returning observable type of

32:25

data. So the syntax was inside this we

32:28

need to write the curly bracket. Then we

32:30

can use

32:31

next like this. This will be your

32:34

subscribe. Then

32:37

error colon like this. Okay. So this is

32:41

the new syntax what we have. This is

32:43

your success and if something error

32:45

happens this will execute. Okay. Now

32:47

here we will say user

32:51

found means once API call is

32:55

success and we will say

32:58

navigating user found only. Okay. Now

33:01

from the login API now we are going to

33:03

get the response. Let's check it first.

33:06

So this is my API right? What was the

33:08

credential we

33:09

created? Uh this is my email

33:12

id. Let's try the login.

33:16

This is my email and password was I

33:17

think 11 1 22 33 3 4 3 only. I'm doing

33:20

the wrong

33:22

password request body. So you can see

33:25

wait why it is saying invalid

33:27

credential. Okay, invalid credential. So

33:29

we are getting the wrong credential. But

33:30

if I remove the 44 this is my actual

33:32

password test

33:35

endpoint. So here you can see we got the

33:38

complete object user ID we got and the

33:40

full name we got means you user is

33:42

successfully logged in. Okay. Now, so

33:46

this API call we need to integrate.

33:47

Let's try it

33:50

now. Let's add a debugger over

33:54

here. And if error is there, it will go

33:56

to over here. And where we will say

34:06

wrong

34:08

credential. Let's add a debugger and

34:10

both the places over in the next and in

34:13

the error also. and in the service also

34:15

because from component we are going to

34:17

make the API call over here. Let's save

34:20

it and check it

34:28

now. Okay. Now, so the user ID was

34:34

Janthegmail.com and I'm passing the

34:36

wrong password first.

34:38

Now on click of sign in you can see we

34:42

have got triggered our API function from

34:44

our login component. Now if you see in

34:47

the form object you got the object. See

34:49

from the reactive form we have extracted

34:51

our object what we need to send to the

34:53

API from component we are making a we

34:56

are executing a function from our

34:57

service. So now it will go over here and

35:00

see whatever the object we pass that we

35:02

got it over here. From here actually we

35:03

are making the API call and once the API

35:05

call is success it will return the

35:07

response. So continue. Yeah. So see we

35:11

got into the error block because

35:12

credentials are incorrect. Okay. Now

35:14

let's pass the correct credential 1 22

35:17

33.

35:20

Execute. Now here you can see we got the

35:22

correct credential.

35:24

Continue. Now see our next block got

35:27

executed. Okay. But here we didn't catch

35:30

the response. So we need to catch the

35:32

response. Whatever it is sending right.

35:34

So for that we need to write result over

35:38

here and whatever the result we get

35:40

means the user detail we got right. So

35:43

that uh in the response we are getting

35:45

the what let me show you we are getting

35:48

the user ID. So this user ID we will

35:51

store to our local storage.

35:59

So this user id we need to store into

36:01

our local storage or session storage

36:03

because on the browser level we need to

36:04

store somewhere which user is logged in.

36:07

So this user id will store

36:10

it. So local storage dot set

36:15

item student id and what we will store

36:20

result dot user id like this. I will be

36:26

capital and we didn't specify the data

36:28

type that's why it giving error if I say

36:30

any now it is you can see error is not

36:32

there capital user ID fine and then we

36:36

are showing the alert user found now

36:39

let's do it one more time because

36:40

current this is the new code what we

36:42

have written let's try let me clear the

36:46

local storage

36:48

first so

36:50

jithanthegmail.com

36:52

1112233 on click of sign in we will get

36:55

the API

36:58

response. See over here we got the

37:01

response and from that user ID we are

37:02

storing to the local storage in the

37:04

student ID

37:06

key. If you check the local storage now

37:09

you can see student ID we have got. So

37:11

now user is logged in. Now here if the

37:14

user is logged in instead of showing

37:16

this login and the registration button

37:17

we should have that other what do we say

37:20

drop-down right? Let me show you that.

37:23

Now our nav bar is in our app component

37:26

over here. So if user is not logged in

37:29

we have to show this otherwise we have

37:30

to show this dropdown other dropdown.

37:33

Okay let me see if that other dropdown

37:35

comes properly. Uh we might need the

37:37

bootstrap do.js but let's

37:40

see. Yeah you can see dropdown is coming

37:42

but we are not able to expand that

37:44

because it needs that bootstrap.js. So

37:46

let's add it also in our

37:49

angular.json over here.

37:53

It will be let me find the correct

37:57

path where it is

38:01

bootstrap bootstrap then list is there

38:06

then js and we need bootstrap.bundle dot

38:11

js. So this js we are going to need. So

38:13

this I will put it over here. Now I'm

38:15

adding the bootstrap do.js. Whenever you

38:17

make changes to the angular.json JSON

38:19

make sure you run your project again

38:21

because otherwise compile it won't have

38:23

the new changes. Fine. So I'm running it

38:28

again. So now that uh drop-down should

38:34

work. Let's reload. Now you can see the

38:38

dropdown started working. Okay. So if

38:41

user is logged in we have to show this

38:43

dropdown otherwise login and the

38:44

restation button. How we are going to

38:46

decide? So if in the local storage we

38:48

have the student ID means user is logged

38:50

in. Fine. So now what we need to do in

38:53

app component we will check if the user

38:56

is logged in or not. But that instead of

38:58

doing that in the app component and

39:00

reading the local storage data we can do

39:02

it in the con our service also. So

39:05

here

39:07

logged user id

39:10

colon string or number also anything

39:15

string is equal to I'm making it empty.

39:18

Now on the constructor I'm reading the

39:20

local storage data loged data local

39:24

storage dot get item and what's our key

39:28

name? Our key name is student ID. So

39:30

this key name will go over

39:32

here. we are reading the local storage

39:34

data. Whenever you read the local

39:36

storage data, we need to add a null

39:37

check. So if log data is not

39:42

null, then only we need to read uh the

39:45

data and put it into this variable. So

39:48

this dotlogged data is equal to log

39:51

data. Okay. Now, so in our service, we

39:55

have created a variable. This variable

39:56

will decide if the uh user is logged in

39:59

or not. If the if the it is if the uh

40:02

variable is empty means user is not

40:04

logged in. If it is has some ID means

40:06

user is logged in. So in our app

40:09

component we will integrate our user

40:11

service. Fine. So

40:14

user

40:17

service inject what we will inject our

40:20

user

40:21

service. Fine. Now in user service we

40:24

have that variable. So that variable we

40:26

can directly access into our HTML. So we

40:28

will use at theative control plus

40:30

statement if user id dot loged in user

40:33

id equal to equal to empty means our

40:36

user is not logged in. So we have to

40:37

show this

40:41

div and add the details. If user ID is

40:45

not empty means we have some ID over

40:47

there. So we have to show

40:52

this. Okay let's save this and check if

40:55

we are able to perform it. Let's save.

40:58

Let's save. Let's save. So currently in

41:01

my local storage I have the ID. So you

41:03

can see drop-down is coming. Okay. If I

41:06

let's say if I remove this delete and if

41:10

I reload again. So now you can see again

41:12

login and registration button is there.

41:13

Fine. Let's complete that log out

41:16

functionality also. So over here we have

41:20

this login log out button.

41:22

So here let's write click event on log

41:27

off. Let's create this function. Now on

41:29

click of log up we need to do two

41:31

things. First we need to remove the

41:34

local storage data. So local storage dot

41:36

remove item. What will be our item name

41:39

that is student ID we need to

41:41

remove and again that variable also we

41:44

need to remove. So this dot user service

41:46

dot log user ID is equal to by default.

41:48

We will set it as empty. Fine. And we

41:51

have to navigate back to the login page

41:53

because let's say user logged in. He's

41:56

currently on the let's say inside the

41:58

application some dashboard or page. But

42:00

if he logged off again we need to

42:01

navigate him back to the website. So we

42:03

need to inject we need to navigate him

42:05

back to the main landing page also. For

42:08

that we will use router

42:10

service.

42:12

Inject

42:14

router. Okay. And after this this dot

42:17

router dot navigate by URL. This is how

42:20

you navigate from your TS. So here I

42:23

will remove navigate to

42:25

home. Fine. Let's see if the login and

42:27

the every all thing. So by default our

42:30

user is not logged in. So you can see

42:31

login and the registration button is

42:32

there. Let's log in. 1 2 3 sign

42:39

in. Wait something is okay. So now you

42:42

see we got the error. If I reload it

42:44

everything will be fine. Okay. And after

42:46

login also we didn't navigate anywhere.

42:49

Right. So if user is successfully logged

42:51

in, we have to navigate to him in

42:53

dashboard or somewhere. So let's import

42:55

this over in the login component. One by

42:58

one thing we have to go. Let's add the

43:00

import. So if user is logged in

43:02

successfully, we have to navigate him

43:04

back to the home component. Fine. Then

43:07

he can navigate uh wherever he wants

43:10

again that menus will be there. So we

43:13

will navigate him back to the home

43:15

component.

43:17

Fine. And one more thing we will need by

43:20

default when user is logged in now uh

43:23

because we are on the login component

43:25

right but once user is logged in our app

43:27

component needs to run it again right so

43:29

let's see if that is happening or

43:33

not let's re let's do the log off again

43:37

first on click of log out you can see

43:39

login and log out button is coming and

43:41

we are navigating to the home component

43:42

let's try it one more

43:44

time 1 22 33 sign

43:48

screen. Yeah. But see this thing is not

43:51

there. But once I reload it is

43:53

happening. So this is happening because

43:56

in this user service when service got

43:58

executed for the first time there only

44:00

we are reading. After login again we

44:02

need to set this particular variable. So

44:03

that we can do in our login component.

44:06

So these are the small small issues you

44:07

are going to face. You need to handle it

44:09

like this. And you will be storing this

44:12

variable again over here. Now it should

44:14

work fine. Let's save it and check it

44:16

one more time. So log out

44:20

login. So see by just simply login page

44:23

also takes so much of time because we

44:25

have so many scenarios to handle. On

44:27

click of sign

44:28

in see now it is coming proper. If I log

44:32

out again I'm going back and local

44:34

storage data is also removed. Fine. So

44:37

first model we have completed that is

44:40

user authentication login and the

44:42

registration process is done. Now we

44:44

will uh first create the competition

44:46

from in the uh college login and then uh

44:50

use student will participate in that

44:52

proa competition

44:58

fine. So we completed the login and the

45:01

registration process. So as I said like

45:02

we have two main roles. One is the

45:05

student and one is the college. So

45:07

student will be registering for more

45:08

here and we'll be using the login page.

45:10

But as I said for college we will just

45:12

have the one user that will be created

45:14

by uh hardcore login will be there. So

45:17

in the user I have already created one

45:19

user that will be admin. So you can see

45:21

this is the user which will be admin

45:24

means college login will be this. So

45:26

let's try to login with

45:29

this login. This is your password

45:34

and sorry password I forgot. I think it

45:37

was admin only. Let's try admin because

45:41

password is encrypted. So I'm not

45:42

sending it back with the API in user.

45:46

Let's try it on sign

45:54

in. Yeah, we got the response and in the

45:58

result you can see we got the role as

46:00

admin. Okay. So if you logged in as a

46:03

college with the college user role you

46:05

will get admin otherwise it will be

46:06

student only. Fine. Now, so this whole

46:10

thing in the response you are getting

46:12

the whole object. Now this whole object

46:13

we need to store into our local storage.

46:16

We have stored the user id but we need

46:17

to store the whole response also. So in

46:21

login success we are storing the user ID

46:23

just like that local storage dot set

46:26

item. I'm storing the whole user

46:29

object logged user and when we are

46:33

storing the local storage data we have

46:35

to store it into the string format. We

46:37

cannot store directly array or object.

46:38

We need to convert it to string. So,

46:41

JSON dot stringify method we will use

46:44

and we will pass the whole object that

46:45

is result. Fine. Now, so this is what we

46:50

have done. Now in the college login, now

46:53

we have two roles. Obviously, if the

46:55

college logged in, we have to show some

46:56

different menu. If the student login, we

46:58

have to show some different menu. Based

46:59

on the role, our menus will be

47:00

different. Fine. So, that we need to do.

47:03

So, our nav bar is in our app component.

47:07

Right here we have our navbar. So in

47:09

navbar let's say home is there,

47:11

competition is there or these are the

47:13

menus are not there. Let's say we need

47:16

competition like college will be

47:18

creating multiple competition right

47:20

because multiple competitions are there

47:22

so they need to create it along with the

47:24

details we have. So we have the API also

47:26

for the creation of the competition. So

47:27

that we are going to first complete. So

47:30

our route for the competition

47:33

was wait I think I didn't create the

47:36

route. Let me check the API first. I

47:39

forgot or

47:43

[Music]

47:45

what? Yeah. Yeah. I have the API. See

47:48

competition ID API is there. Yeah. Post

47:51

API is over here. So we can create the

47:53

competition but we need the component

47:55

also for that. Let me just create one

47:56

more component.

48:01

ng generate

48:04

component competition.

48:12

Let me just create quickly the route.

48:16

So because from this page college will

48:18

be creating multiple competition. Okay.

48:27

So fine and this URL we have to put it

48:30

over here on router

48:33

link.

48:38

Fine. Let me check if it is running.

48:45

Yeah. So we are able to navigate to the

48:48

competition. Now in this competition we

48:49

are to in integrate this API. So if you

48:52

see the object we have competition ID

48:55

that is our primary key title of the

48:57

competition description start date end

48:59

and the status like it is going or

49:01

closed or uh hold whatever status we

49:03

need to give. So it's a simple form

49:05

right. So

49:07

uh let me check if we have UI for the

49:11

competition. I think I didn't create the

49:13

UI for creating the competition. Yeah.

49:16

Okay. Let's create a normal form for

49:18

this. Let's close

49:24

it or let's try charge

49:28

GPT. We will ask charge GP to create the

49:32

UI design form for this competition. So

49:34

this is our object. Okay. So what we

49:35

will do? We will copy this object. We

49:37

will paste it over

49:39

here and we will say I

49:42

need

49:44

CRUD UI

49:46

design for this object.

49:51

Now we need to specify like what

49:53

technology also right. So use

49:56

bootstrap

49:58

to design this. Again let's say you need

50:02

uh in a one in a single component you

50:04

are going to do the card operation. So

50:05

you need two card in one card you will

50:07

have

50:09

the list and another card you will have

50:11

the form. So use card design

50:16

row call let's say

50:19

call seven

50:22

for table and call five for

50:29

form let's

50:33

see it should give us the basic HTML

50:36

code yeah it is providing the basic HTML

50:38

because we didn't specify angle or

50:40

something we just provided like we need

50:41

HTML So it is pro it is providing the

50:43

basic HTML page. Let it write complete

50:46

code. See use AI like if you are

50:50

comfortable with UI and like you have

50:52

experience. So don't waste your time

50:53

writing or creating the UI. Use AI to uh

50:58

uh what do we say to remove that

51:01

unnecessary work and unnecessary time

51:03

wasting in just to design the UI. Right?

51:05

So you can save that time by using the

51:06

UI. Now we need this

51:12

Let's copy and this HTML code will go

51:15

over here. Let's save and check how our

51:18

page is

51:20

coming. So see we got the page. Okay. We

51:23

don't need this title. So we will remove

51:26

it. Yeah. So let's remove

51:31

this. And we need to match this with the

51:34

remaining things. So I will

51:36

copy where we had that. Okay. Let it be

51:40

for now. So we got the UI. So if you see

51:43

in the last in the second in the first

51:46

card we have the list of the competition

51:48

and here we will have the form. So

51:49

competition ID we don't need. So let's

51:51

remove that because that's a primary key

51:53

ID. Primary key. So we don't show the

51:55

primary key in the UI. So title we have

51:59

then description start date end date and

52:00

the status. So status by default we will

52:03

send it as a hardcoded one or new. Then

52:05

in the update mode we will uh update it.

52:08

So for now we will keep it. But in the

52:09

update mode only this should be visible.

52:11

Fine. So this is our form. Now this is

52:15

our object. So now in the login and the

52:18

registration process we have when we

52:19

created the variable we have gone with

52:21

any. Now we will use the class or the

52:23

interface. So you should not use any

52:25

whenever you are creating any object. So

52:28

let's copy this. Now I have to create

52:29

the interface or class. Basically class

52:32

I will create. So in src folder app

52:35

again I will create one folder that we

52:37

will say model in model first uh class

52:41

I'm creating for the

52:44

competition competition domodel

52:48

dot ts now inside this ts we have to

52:52

create a class so

52:54

export class

52:57

our computation

53:00

model these are the things we are going

53:02

to

53:04

Now we just need to provide a proper

53:05

data type to

53:07

this colon

53:12

number just like this. Colon string will

53:16

be over

53:21

here. Fine. Just like this. Let me just

53:24

replace it.

53:29

So whenever you do the API integration

53:31

now see what object you need to send

53:32

along with the API you copy that and you

53:34

create the properties like this. So this

53:36

is like a class you have created just

53:38

whatever the properties you have to send

53:40

along with your API that you will create

53:41

it over here along with the specific

53:43

data type. Fine. So since it's a class

53:46

so it will have an access to the

53:47

construct. So that's the error we are

53:48

getting saying like uh these properties

53:50

are not initialized. So what we have

53:52

it's a class so we can have constructor

53:54

and in constructor we will initialize

53:56

all the properties. By default it will

53:57

be zero. Then description it will be

54:04

empty. Start date is equal to empty.

54:06

Just I'm going with string

54:09

only. End date is equal to

54:12

empty. Status is equal to by default I'm

54:15

setting as new because as I said we need

54:17

to send the by default status from UI

54:19

when we are creating. So this dot what

54:22

is remaining title. Again we will

54:24

initialize this entry. So this is your

54:26

class will look like. Whenever you do

54:27

the API integration, see what object you

54:29

have, you will create a class like this.

54:31

Now in our HTML, so let's close this.

54:35

Now here we have to again we will use

54:37

the template form now.

54:39

So new object data type will be

54:43

computation

54:44

model is equal to new. We have to

54:47

initialize this particular model. It's a

54:49

class. So we can initialize it like

54:51

this. So whenever you do like this your

54:53

constructor get executed and all the

54:55

properties from your class get

54:56

initialized to whatever the default

54:58

value you said in the constructor. Fine.

55:00

Again as I said we are going to use

55:02

forms template form. So we have to

55:04

import forms module over here. Let's

55:07

open it side by side.

55:10

Now sorry I closed

55:17

that. Fine. So this is our class. uh

55:20

this is our form. So everywhere we need

55:22

to bind the ngm model. So square bracket

55:24

round bracket

55:26

ngmodel is equal to double close. Now

55:29

here our new

55:31

object dot see the benefit of creating

55:35

class it will provide you all the

55:36

properties of the intellisense right

55:39

like whatever the properties we have in

55:40

that particular class it will

55:42

intellisense over here. So now you don't

55:44

you won't make the spelling mistake and

55:46

uh any wrong property name you won't be

55:49

using because it is providing everything

55:51

right if you specify anything still it

55:54

will give you an error right so this is

55:55

strongly type what we do so this is for

55:58

title so title again name property also

56:00

we need name dot same property what you

56:03

bind it over here it will go over here

56:05

now I will copy and paste it over

56:12

Here year here

56:17

description here start

56:20

date instead of date time local I just

56:23

need date

56:25

only fine then we have end

56:30

date and here

56:34

status and same property we need to bind

56:36

it over

56:41

here. Okay. So, we created object that

56:44

object we have binded to the form. Now,

56:47

we need API call integration, right? On

56:49

clicks, we are going to need we are

56:51

going to do the API call integration.

56:53

So, for that we need the service,

56:58

right? So, in service now I will create

57:01

one more service. See if your project is

57:04

small it doesn't matter let's say around

57:06

five to six component or even 12

57:08

components or 13 components are there so

57:10

you can write all the services API call

57:12

function into single service also but

57:14

again just to separate your code you

57:16

should create multiple services

57:17

according to your module now all the

57:19

user related services will go function

57:22

will go over here now we are moving

57:24

towards the competition so all the API

57:26

call function related to competition

57:27

should be in a separate service so let's

57:29

create one more

57:31

service whenever you are appearing for

57:33

the machine test also. Try to create

57:34

multiple service so that you can you are

57:37

explaining to the interviewer like yes

57:39

we can create multiple services right

57:41

generate service according to the model

57:44

we should create it let's say

57:47

competition enter so it will it will

57:49

create our competition service now so in

57:53

competition service we need the API

57:55

calls

57:58

now let me close everything for now now

58:02

again we need to inject our private

58:03

create

58:05

http client fine now here we need the

58:09

API call so first will be like

58:13

create

58:15

competition now in all the API call our

58:18

URL is going to be common right so this

58:21

is the URL which will be common just our

58:23

method name is going to change so this I

58:26

will put it into my constant file so we

58:29

can go for the environment file also but

58:31

I don't want to make things complicated

58:32

so that's So I'm creating a constant

58:34

folder constant and inside this constant

58:37

folder I will be creating my constant

58:41

file

58:47

constant.ts and here we have to create a

58:49

constant. So export

58:57

constant okay

59:00

API URL and my common URL I will put it

59:04

over here normally we move this into our

59:06

environment folder but like considering

59:08

like you are fresher or some of us are

59:11

some of you are going to be a fresher so

59:13

that's why I'm not going with the

59:15

environment folder but same thing we

59:17

will do it over there also right you

59:19

have to those who experience you can

59:20

create the environment folder by ng

59:22

generate environments it will create the

59:24

folder and this you can move it over

59:25

there fine now we have created a

59:28

constant over there we have put our

59:29

common URL so now over here here also we

59:32

can use that so

59:36

constant dot API URL so now I don't need

59:40

this static everywhere else I will just

59:42

need the method name like this okay like

59:47

this now in our service also

59:49

So return this dohttp dot post API

59:54

call. So

59:56

constant dot API URL plus let's get the

60:00

method name for the create. So method

60:03

name will be like this. Let me just test

60:06

it. This is my

60:10

URL and we need an object because this

60:13

function we are going to call from the

60:15

component. So we will need an object for

60:17

that.

60:20

So

60:22

obj what type of data we are going to

60:24

get

60:25

competition competition model right and

60:28

this

60:29

object we will pass it as a second

60:32

parameter over here this is your API

60:34

call function for create just like that

60:36

let's create a get API call

60:39

also so it will be get

60:43

computation method will be instead of

60:45

post it will be get we won't need a

60:47

parame parameter because it's simple a

60:49

get API

60:50

call and let's check the method name

60:53

also

60:57

competition okay I think I forgot to

61:00

create API to just get all the

61:03

competition yeah we don't have

61:06

API just post API is there then we have

61:09

API

61:12

for okay so I have created this get API

61:15

which will get us all the computation

61:17

Just now I have created uh it will be

61:19

available in the swagger also but I

61:22

didn't deploy this yet. Okay. Now this

61:24

is this will be my get API to get all

61:27

the competition. So this is my method

61:28

name. So this will go over here a simple

61:31

get API. Okay. Now we have two API call

61:34

for create one for the create

61:36

competition and one for the get on

61:38

computation. Now this API call we need

61:39

to integrate into our component. Fine.

61:41

Let's move back into our computation

61:45

component. Now here if you see we have

61:48

created this object. This object we have

61:50

binded to our form also. Now we on click

61:52

of this save we need to integrate our

61:54

API. So click on save. Fine. Let's

61:59

create this function

62:03

quickly. Now our API call function is on

62:06

service. So let's create instance of our

62:07

service

62:12

also is equal to inject. What we need to

62:15

inject? computation

62:18

service. Fine. Now here we need to

62:21

integrate the API call. So this dot

62:23

computation service dot currently we

62:26

have two API call function but on save

62:28

this function we need to call this

62:30

function needs a parameter. So this dot

62:32

new object we will pass dots subscribe

62:35

round bracket curly bracket

62:41

next arrow

62:48

function. Fine. Now this will be our

62:51

success call. This will be our error

62:52

clock. If API call is success this will

62:54

execute otherwise this. So here we will

62:56

say

62:59

alert competition created. Fine. And

63:03

here we will get the error. So that

63:05

error we will show it over here. Alert.

63:08

We will simply say API error for

63:12

now. And just like the same method we

63:15

need one more to get all the

63:16

competition. Right? So let copy

63:19

paste get all. And instead of this

63:23

create computation, it will be get

63:25

computation. We don't need object

63:27

parameter for this function. Now we need

63:30

a variable also to store all the

63:31

computation we get. So grid list colon

63:36

what type of data I'm going to get a

63:38

list of this. So array of this like

63:40

this. Okay. Now whatever the data we get

63:43

that we will get it over here. So this

63:45

dot grid list is equal to here I will

63:49

say

63:50

result API response we will catch it

63:52

over here. Then this we will store it

63:54

over here. What is the error? Okay. So

63:57

now you can see here we have specified

63:59

the data type of this like in this

64:01

variable we are going to store array of

64:03

this but this function we didn't specify

64:05

the return type right. So here also we

64:07

need to specify the return type. So

64:09

colon observable type of data we are

64:11

going to return and competition model

64:14

array like this. So everywhere you need

64:16

to provide a proper data typing so that

64:18

it will match what data we are going to

64:20

get what data we are going to store and

64:22

this function we need to call on the

64:24

page load. So we will imple we will use

64:26

our life cycle event that is on

64:29

init and then ng on init and here we

64:33

need to call this function that is get

64:35

on fine let's just format

64:40

it now we our two API call functions are

64:44

ready get and the post now get we will

64:46

get the data over here this we need to

64:48

iterate on the table so here you can see

64:50

this is the tr we will have so at the

64:53

rate for control statement I'm using on

64:56

this array we need to iterate and this

64:58

tr will go inside

65:04

this here we have to show the serial

65:06

number so dollar index we will use

65:08

indexing will start from the zero so we

65:10

have to increment by

65:12

one then here

65:16

interpolation item dot what it will be

65:20

title let me just copy paste this

65:27

We don't need edit and delete

65:28

functionality for now. So let's remove

65:30

it. Here title is there. Then start

65:33

date. Then end date. This is what date

65:37

we are going to get. So let's add a date

65:39

pipe also. To use date pipe first we

65:41

need to import the date pipe. So over

65:45

here pipe we need to import then we can

65:47

use the date pipe. So start

65:50

date

65:53

slash date and we can pass the format.

65:55

So

65:58

DD-m

66:00

y just like this. Copy and paste it over

66:03

here. Let's format it properly. Fine. So

66:07

everything is ready. Now we just have to

66:09

test

66:13

it. Uh this is static. Why static is

66:15

visible? Okay. Okay, I think we have

66:17

currently we have one record over here.

66:19

If you see the API, currently we just

66:20

have one data over here. Now let's try

66:23

to create let's say competition is like

66:27

uh paper presentation competition is

66:31

there description something start date

66:34

let's say it is going to start from

66:37

uh 1st of

66:39

April and

66:42

then sorry June to 30 June. Okay. And

66:47

status by default. Okay. We are setting

66:50

by default as uh new. So it doesn't

66:52

matter. Let's check the API call. One

66:55

more thing after save we didn't call the

66:57

get API but let's see if competition is

66:59

getting created first. So on click of

67:01

save one API call is there and return is

67:04

2.1 means competition got created. Okay.

67:06

Currently it is not visible because

67:09

on on click on success of save we didn't

67:12

call this function. So this function we

67:14

need to call it over here also. So that

67:17

once the competition is created we will

67:19

again call the get API. So the latest

67:20

record will be visible. Now you can see

67:23

paper presentation is visible. Now if I

67:25

say

67:28

web fista something name I'm giving

67:33

description let's say it is going to

67:35

start from 15th of the

67:37

June until

67:41

last 30. Okay. If I click on save

67:46

competition created and you can see the

67:49

latest record is visible over here. Got

67:51

it? So we are able to create the

67:53

competition. Okay, update and the

67:55

deleting you can do because I need to

67:57

complete so many things. So I'm skipping

67:58

the edit and the delete part. But uh the

68:01

same thing I have create completed in so

68:03

many tutorials. So just refer any and

68:05

just complete the edit and the delete

68:06

operation. If I have the time I will try

68:08

to complete it and push the code also.

68:11

Fine. So we are able to create the

68:12

competition. Now this competition we

68:14

need to show into the website. Fine.

68:17

Then user will uh participate onto that

68:19

the students. Fine. So let's start on

68:22

that now.

68:29

So now after creating the competition if

68:31

you visit the homepage on the homepage

68:33

we have to show the competition. See

68:35

these are the competition cards we have.

68:37

Now in the competition I don't uh means

68:40

in the competition table I didn't create

68:41

the image but we UI we got it like this

68:44

but instead of image whatever remaining

68:45

data we have fine. Now in the homepage

68:48

we have to get all the competition and

68:50

that competition we have to show it over

68:52

here according to the date and whatever

68:54

things we have fine so on the home

68:56

component we just need to integrate this

68:58

API get all API this service we have

69:00

created right so see the benefit of

69:02

service like we have created this one

69:04

function at over here so now wherever

69:07

you need the competition data you can

69:08

just integrate this service you don't

69:10

want to you don't have to create again

69:12

api call right now let's do it quickly

69:17

Okay. So that is our home component. So

69:20

in home component also we need to inject

69:21

our service. So that will be SRV is

69:24

equal to inject. What service we are

69:26

going to inject? So

69:29

competition. Fine. Again on the page

69:32

load we need to integrate. Now see uh

69:35

till now we have done the normal GP

69:37

integration. On the page load we are

69:38

making the get APL and we are storing it

69:40

into variable. But the problem with that

69:42

now we have to unsubscribe that also

69:45

because you are creating a subscription

69:47

object that will stays over there. So

69:49

that will cause the memory leak. So

69:50

another way is like we can use the async

69:52

pipe. So here I'm explaining another one

69:54

topic. So instead of creating a variable

69:56

subscribing and then storing into that

69:58

data I'm going to create an observable

70:00

type of data. Let's

70:02

say

70:04

computation list colon uh dollar. So we

70:09

are going to store observable type of

70:11

data. What type of array I'm going to

70:12

store? So computation

70:16

model array of

70:20

this new

70:23

observable. So I'm creating observable

70:25

type of variable over

70:27

here. It's simple variable but in that

70:29

that variable we are going to store

70:31

observable type of data. Now in

70:33

constructor what we can do this dot

70:37

observable is equal to this dot service

70:41

dot this function. So see here I'm not

70:44

subscribing whatever the data I'm going

70:46

to get it from this function API call

70:48

function. I will subscribe directly into

70:50

the HTML but for that we need to import

70:52

a sync pipe. So a sync pipe we need to

70:56

import. Then in home component where we

70:59

have

71:00

computation. Yes I think this is the

71:02

div. Yeah. So let's remove the static

71:04

one and here at the red for loop. Now

71:09

here our observable and we will use a

71:12

sync type. So like what we used to do we

71:14

used to subscribe and then store into

71:16

variable. So that thing we are directly

71:18

subscribing into the HTML directly.

71:21

Okay. Now this will go over here. Let me

71:24

just

71:28

format. Now over here we don't have the

71:30

image. So let's remove the image. Now

71:32

here we have to show the title. So curly

71:35

bracket curly bracket item dot title

71:39

will go over

71:41

here. Then here we have to show the

71:46

description. So description let just

71:49

save it and check if we are able to see

71:50

the competition. Currently we have just

71:52

two comp three competitions. So E right

71:55

you can see the competitions are

71:56

available over here. Right now we don't

71:58

have the image. So that again like the

72:00

template got created considering it's a

72:03

project competition. So it has assumed

72:05

like so many fields will be there

72:06

because I have used the AI but in our

72:08

object we don't have so many things. So

72:11

title we have uh AI invitation. So this

72:14

we can remove here we have to show the

72:16

end

72:17

date. So here it will be item dot end

72:21

date and again date pipe will be there.

72:23

So we need to import the date pipe also.

72:26

Date

72:28

pipe and

72:30

here date

72:35

sorry date pipe

72:38

and parameter dd - mmmmmm - y y y y y y

72:42

y y y y y y y y y y y y y y y y y y y y

72:43

y y y y y y y y y y y y y y y uh teams

72:44

we don't have it so let's remove this

72:49

also let's say okay so you can see date

72:52

is coming according to whatever we said

72:54

so whatever the competition we created

72:56

that are available over here now. So we

73:00

logged in as a we have to loged in as a

73:02

student now. So I think we are logged

73:05

okay we forgot to show the logged in

73:07

username also. If you check the local

73:11

storage student ID is there let's log

73:14

off again. Let's try to log again. What

73:17

was the user

73:21

API all user? So this was my user

73:25

ID. Let's try with login and password

73:29

was

73:30

admin sign

73:36

in. So when you are logging we are

73:39

storing the whole object also. So if you

73:41

check the local storage see logged user

73:43

data and here you get the username. So

73:45

this email you need to show it over

73:47

here. Over here username is there now.

73:49

So there we need to show the email. So

73:52

when we were doing when we were doing

73:54

the login part, we store the data into

73:56

local storage and in our service also.

73:58

So let's create one more variable

74:04

logged user data colon. What type of

74:08

data? We didn't create the interface or

74:10

class for the user. So let's go with any

74:13

fine. And by default we will say

74:16

undefined.

74:19

And over here just like we have done it

74:22

over here. Ah one more thing when you

74:25

are storing the object we have converted

74:27

it into the string format. So again when

74:29

you are reading it back you need to

74:30

convert it back to the uh object format.

74:33

So for that let's remove one more data

74:38

constant logged user data local

74:44

storage dot get item our key name. So

74:48

key name is logged user. So this we have

74:50

to pass it over here. And this same

74:53

check we will add it over here.

74:55

And not equal to null means whenever you

74:58

are reading the data and you are doing

74:59

something so we have to add a null

75:01

check. So this dot loged user data is

75:04

equal to JSON.parse. So here we got the

75:07

string format. Again we need to convert

75:08

it to the object. So we have to use this

75:10

loged user data. We will pass it over

75:12

here. So in my service we have this

75:14

variable. Now same thing here also we

75:17

need to do just like we have stored the

75:18

user

75:20

id dot log user data is equal to

75:23

complete results fine now so we got the

75:26

data so that we need to show into our

75:29

navbar over here so instead of

75:33

this so it will be user service dot

75:38

logged user data dot

75:41

uh it will ask us to add email I

75:45

Let's check the local storage one more

75:47

time. Yeah. Email only. Fine. Let's

75:49

save. Let's save. Let's save. And

75:53

if Yeah. So here you can see admin at

75:55

thegmail.com means it's a college login.

75:57

We are able to see whatever the logged

75:59

in user is there. That name is getting

76:01

populated over here. Now we have

76:03

to we uh login registration part is

76:06

done. College has created some

76:08

competition. Now student will

76:09

participate in that production. Correct?

76:11

So the last phase like student will

76:14

submit his participation to the

76:16

particular competition.

76:18

Right? So let's do that. Now we will

76:20

login with the

76:30

student. So what was the student detail?

76:34

I think this one. Yeah. So let's try to

76:37

login with my

76:38

detail.

76:40

Let's wait we logged off. Okay. So in

76:44

log off also this recent variable we

76:47

created just now. So in log of function

76:48

we need to remove that also. So again in

76:51

app component just like this we have one

76:54

more data right that is logged user.

76:58

We'll go over here. Fine. Let's try to

77:01

login now.

77:04

This is my

77:06

username. 1 22 233 was my password. On

77:09

click of sign in user

77:13

found. See we are logged in. Now in home

77:17

component we are showing all the

77:19

competition. Let's say if I click on

77:21

view detail I should navigate to the

77:23

submit project with the competition ID

77:27

because this is the competition user is

77:29

going to participate. So on click of

77:30

view detail it should navigate to the

77:32

view that our post competition page and

77:35

there we will register for that

77:36

competition. So that's the component is

77:39

let me show you the UI first of

77:41

that it is yeah so this is the page. So

77:45

where here we will have the form for

77:47

submit project and here we will show the

77:49

selected competition detail also. That's

77:52

why we need a route where we will pass

77:54

while navigating to this page we will

77:56

pass the ID also. Fine. So now we have

77:59

to change our route a little

78:01

bit. So submit project. Now instead of

78:03

the normal route it will be

78:05

parameterized route. So colon

78:08

id / colon id now. So from home

78:12

component when we navigate to this we

78:14

are going to pass the computation ID.

78:16

Fine. Let's do that. So over here we

78:20

need the router link. So let's import

78:21

router

78:24

link. And over here instead of

78:30

href router link is equal to slash our

78:34

route name. Our route name

78:37

is submit

78:40

project and we need to pass the

78:42

competition ID. So let's use the

78:44

property binding because we need to do

78:46

the interpolation also over here.

78:53

static single quote plus here we need to

78:57

pass item dot competition id fine let's

79:02

save and check it if we are able to

79:04

navigate with the query parameter

79:09

now fine so let's see now so currently

79:12

we have three competition if I click on

79:14

the middle

79:15

one we have error let's check what's the

79:18

error I think parameter name

79:21

Yeah. So slash should be first then

79:25

this. Let's try now. Every time I get

79:28

confused with this now click of view

79:30

detail. Wait why

79:33

still. Okay. So you can see our URL is

79:36

getting formed like this student

79:37

project/2. That's

79:39

because this was correct over here. We

79:43

forgot to add the slash. Okay. Let's try

79:46

it now. Now if I click on the middle

79:48

one. See I'm able to navigate with the

79:51

ID again. Let's go to the homepage.

79:53

Let's try with the third. So whatever

79:55

the competition you click with that ID

79:57

we are able to navigate. Now in submit

79:59

project we have to first call the get

80:01

API because here we got the competition

80:03

ID. That competition detail we need to

80:05

show it over here. Correct? So we need

80:07

to make that another API call which will

80:09

get us the competition detail of the

80:11

particular competition ID. So the API is

80:15

this is the API. So let's say if I pass

80:17

two over

80:19

here see I got the current competition

80:22

detail. No

80:25

why I think URL is let's try it over

80:28

here. Some extra characters is going

80:30

over there.

80:43

ID question mark id is equal to

80:49

this or do we need a slash directly? Let

80:52

me just check the URL. Yeah. Okay. So

80:55

this should be our URL. So make sure on

80:56

click of edit you made you make this

80:58

kind of API. So this is our API where we

81:01

will pass the id of that computation and

81:04

that computation data we will get. So we

81:06

have already created a service for it.

81:08

So let's add one more API call. It will

81:11

be same like this just parameter will be

81:14

there. So this will be my URL over here.

81:18

Two should be static. So plus two should

81:20

be dynamic. So id colon

81:23

number and this ID we have to pass it

81:25

over here. get

81:27

computation by

81:30

id. Okay, this is the function and we

81:33

are going to get the single instance of.

81:35

So that's why we don't need it array. So

81:38

this function we need to call on the

81:40

page load of the this component. So we

81:42

need to read the query parameter data.

81:44

So now in angular whenever you have to

81:46

read the query parameter data. Okay,

81:48

let's just get the UI also. Let me just

81:51

get the UI of that submit project page.

81:56

Submit project. This is the

82:00

page. Let me just get the

82:09

UI. Let's

82:12

copy. This will go over

82:16

here. Right now in the in this component

82:20

we have while navigating to this

82:22

component we are going to have a

82:23

parameter query parameter in the URL. So

82:25

we need to read that and then we have to

82:27

trigger that API call to get the

82:28

computation detail. So for that let's

82:31

create constructor and we have to inject

82:34

activated route service

82:36

private

82:38

activated route

82:41

colon activated route and over here

82:44

inside the

82:46

service params dots subscribe. So

82:50

whatever the query parameter you have

82:52

you have you can read that query meter

82:53

by subscribing to them.

82:58

Okay. Fine. Now

83:05

here we will

83:07

say

83:09

current competition

83:12

id but I'm assigning zero. This we need

83:15

to assign over here. So this dot

83:17

computation id is equal

83:19

to result dot id. we will get whatever

83:23

the query parameter name you have given

83:25

over

83:28

there dot id. So this parameter name

83:31

will be whatever the parameter name you

83:33

give it over here ID. Okay. Why it's

83:36

giving an error? Yep. Okay. So we need

83:38

to specify the data type any over

83:41

here. Okay. So whatever the query

83:44

parameter we have that we will read it

83:45

over here. Then we need a function. Now

83:47

we have created API call in our

83:49

computition service. So let's import

83:51

that also. Service is equal to

83:54

inject

83:58

competition service. And let's create

84:00

another function.

84:03

Get by

84:08

ID this

84:12

dot service dot get computation of ID.

84:16

This function we need to call and here

84:17

we will pass our variable that is

84:19

current competition ID dot subscribe

84:21

round

84:22

bracket curly bracket

84:26

next here we will get the

84:29

data. Okay. Now whatever the data we get

84:32

that we need to store in two

84:34

variable

84:37

p computation

84:42

data we have created our model. So let's

84:45

use that over here.

84:53

Okay. Now this dot computation data is

84:57

equal to whatever the result you get. So

84:59

this you will assign it over here. Fine.

85:02

And this function you need to call

85:03

inside the subscribe. Once you read the

85:05

data then only you need to make this API

85:07

call not on the page load. Okay. Now the

85:10

data you will get it over here. This you

85:11

need to show it also. Where is the

85:13

competition

85:14

[Music]

85:17

data let us

85:19

see this is call it submission

85:23

guideline. Okay here it is. So here we

85:26

need to show display none we need to

85:29

hide here it will be let's say our title

85:35

name dot

85:38

title then

85:42

deadline this is again date pipe we have

85:44

to use so end date I'm not giving the

85:47

date for now this will be our

85:49

description

85:57

item sorry competition data competition

86:00

data dot description and we don't have

86:04

require requirement or

86:08

something right let's

86:10

save

86:12

and let's test it if we are able to see

86:15

the competition data whatever we

86:20

one currently it is three so you can see

86:24

deadline is soon let's go back let's

86:27

select the first

86:29

one wait why it is not

86:32

visible yeah now if I click on the oh I

86:36

forgot I didn't created the proper data

86:39

I

86:41

think let's check

86:43

the get API call if API call is going

86:46

proper

86:49

on the page load. Oh, it is giving four

86:52

not

86:53

four. We have some percent 20. So, I

86:56

think some space is there.

86:58

[Music]

87:00

H over

87:03

here. Let's try

87:09

now. Yeah, now API call is there. See

87:12

paper presentation and date is also

87:13

coming and description whatever it is

87:15

there. Right. So now you can see the

87:17

whatever the present whatever the

87:19

competition we selected that is coming

87:20

over here. Now here let me show you the

87:23

object of the

87:26

submit where it is

87:31

post. So here you need the competition

87:33

ID. So now the competition ID you

87:36

already have it over here in the

87:37

browser. So this competition. So now

87:39

here you don't need the drop-down of the

87:41

competition because you selected your

87:43

competition already. Correct? So one

87:46

more thing like one approach is like you

87:48

can use this ID and assign it to your

87:50

object or here you can show the

87:51

competition drop-down also and again you

87:53

can change it also. Let's say user

87:55

selected one but again he want to change

87:57

so he can change it from here also.

87:58

There are two approaches you can do that

88:00

we will go with the first one instead of

88:02

showing this we will assign the object

88:04

directly. So this is my object which I

88:06

want to pass to the API to create the to

88:10

participate submit the project. Here you

88:13

can see you have two foreign keys

88:14

competition ID and the user ID. User ID

88:16

will be logged in student ID and

88:18

competition ID will be from the URL this

88:20

competition. Okay, let's copy this.

88:24

Let's create the interface. Now we can

88:27

create a class or interface by using

88:29

some another site also. So that will be

88:33

convert JSON to TS. Some sites are there

88:36

which will allow users to create

88:38

quickly. So I have copied my JSON. So

88:40

this JSON we need to put it over here

88:43

and it will help us to create. See

88:45

according to the property and the data

88:46

type it has created. Now we are created

88:50

model. So inside same model I'm

88:53

creating export instead of interface I

88:56

will be going with class and here it

88:58

will

89:00

be

89:02

project and all the properties we need

89:04

to initialize again

89:07

constructor. Let me quickly initialize

89:09

all the

89:12

properties. So you can see I have

89:14

initialized all the properties.

89:17

Now let me just close it. Now in

89:20

competition we need one more API to post

89:22

it. Right?

89:24

So here let's copy paste and it will be

89:29

submit

89:32

project. Fine. And here our URL will be

89:35

let's check the

89:37

URL project only. Let's copy it will go

89:42

over

89:45

here. Fine. And our model will be our

89:49

project model. We will get like this.

89:52

Fine. So this is our API

89:55

submit. Okay. Now this function we have

89:58

created which is going to make our API

89:59

call and this we just have to call in

90:01

the uh from our component. Now we

90:03

created uh instance of our competition

90:06

data that we got it over here. Just like

90:08

that we have a form. So we need to

90:10

create the instance of our project also.

90:12

Project OBJ colon project is equal to we

90:18

need to initialize

90:22

it. Okay. Now we need to bind it. So

90:24

again template form is there. So we need

90:26

to import our forms

90:29

module. Let's open it side by side.

90:37

close

90:40

file. Okay. So we created this object.

90:43

Now this object we need to bind to our

90:45

form. So here you can see we have the

90:47

form. So we said like this we are not

90:49

going to use. So for now I'm commenting

90:50

it. Then project

90:53

title. So you can see we have text box.

90:55

So I can how we can speed up our

90:58

development. So we need to add ngmodel

91:01

in all the uh on all the input element

91:04

right. So what I can do

91:06

ngmodel is equal

91:08

to our object name is project

91:12

object dot then we need the name

91:15

attribute also. So name is equal to so

91:18

what I will do I will copy

91:21

this search form control class and then

91:24

I will replace that with this. So within

91:27

one click I'm replacing everywhere right

91:30

now here only it will get repeat or

91:32

let's remove that now here I just need

91:35

to bind the properties now so it will be

91:37

little bit quicker now so project title

91:40

same copy paste you need to

91:42

do this is description then copy paste

91:49

uh tags I think we don't have it now

91:51

yeah we don't have tags so let's remove

91:54

that team member number it's not

91:57

multiple it is going to be a single only

91:59

comma separator they can

92:07

add so it will be team

92:15

members properties we

92:18

have okay team members also we don't

92:21

have it so computer description GitHub

92:24

link project title

92:25

submission date. So, submission date we

92:28

need input. Oh, it's a text

92:31

area. Oh, sorry. I didn't check the form

92:34

properly. But anyway, you are you might

92:36

be able to understand

92:40

this. Submission date. It will go over

92:43

here and over

92:46

here. Let's remove the text area. And

92:49

here it will be date. Fine. Team members

92:53

block. We don't have it in the API. So

92:54

we don't need it over here. Then we have

92:57

GitHub URL. So GitHub

93:04

link then we have live URL is also not

93:08

there. I think I had that live

93:12

URL. Okay fine. Anyway, so remaining

93:15

things only we will project file also we

93:17

don't

93:18

need this also we don't need. Okay. So

93:22

whatever the object we created that we

93:24

have binded. Now on click of submit

93:28

let's go with button we need to call our

93:30

API. So click on

93:33

save. Let's create this

93:41

function now. So remaining things we are

93:44

going to get from the form but user ID

93:46

and the what do we

93:49

say competition ID we get it from the

93:51

URL. Right. So this dot project dot user

93:56

ID. So user ID we are going to get from

93:58

the logged in user id. So we are storing

94:00

the loged in user data into our service

94:02

that is user service. So let's create in

94:04

let's inject that service also. So user

94:07

service and here it will be user

94:11

service. Now this user service this dot

94:14

user service dot loged user ID. In this

94:17

variable we have the loged in user ID. I

94:20

think it is number and string. Let's

94:23

convert it into

94:28

number. Fine. Then we need the

94:31

competition ID. So competition ID we

94:32

have already got it into our

94:37

variable. This dot current competition

94:40

ID which we read from the URL. See over

94:42

here. Right. Then we need to make the AP

94:45

also. This dot service dot submit

94:48

project. And we have to pass the this

94:50

dot new project object dots

94:54

subscribe round bracket curly bracket

95:06

next.

95:15

Okay. Fine. Now let's add a debugger

95:19

over here also so that I can show you

95:21

like the remaining data we are getting

95:22

from the UI and some we are reading it

95:25

from the variables. Let's add it. Let's

95:28

add it and let's check it. We call the

95:30

function also over here. Let's save it

95:33

and check it

95:36

now. Let's say I'm trying to submit for

95:40

the I'm applying for the paper

95:41

presentation. So let's say global

95:44

warning something my project name some

95:48

description I will

95:49

have then oh my god team member we

95:53

forgot team member we don't have just

95:55

the label change okay submission date

95:58

today and something URL

96:00

now on click of

96:03

submit so now currently if you see the

96:06

project object some data we have got it

96:08

over here now some data we are going to

96:10

get from the our variable so user ID we

96:12

got competition ID we got. Okay. Now we

96:15

are sending rank and the status as empty

96:17

because that is going to handle from the

96:18

API. So let's click on continue. Yeah.

96:22

So API call is success. So we got we

96:24

have created the we have submitted the

96:26

project. Now our project ID was two. So

96:30

let's check the submission we have got

96:32

for the project

96:33

ID. Sorry competition ID. So competition

96:36

ID is two. Test endpoint.

96:40

Wait, what's this API by competition?

96:43

Let's check if the data is submitted or

96:45

not. Let me check

96:48

the I'm checking the database. Okay,

96:51

just give me a minute. Project

96:56

DB college project submission. This is

96:59

my table. Yeah, we got the data. Why it

97:01

is not coming in the

97:03

API? Do we have another API where I can

97:05

see all the projects submitted? This is

97:07

post API.

97:11

project API. So this is that

97:14

API

97:15

project/by competition and the

97:17

competition

97:19

ID. Where is the get API to get all the

97:23

competition

97:25

received. I think again I forgot to

97:27

create one more API but this should

97:29

work. The last API is like get

97:31

competition by competition ID.

97:34

Let's try to execute this in the new

97:37

tab

97:39

/2. Yeah. Okay. So, we are getting see.

97:42

So, one user got one user have

97:44

submitted. So, you can see for this

97:46

competition one project submission we

97:48

have got. Okay. Just like that. Let's

97:51

create one more

97:53

user log of register. Let's say

98:00

Rahul Rahul at the

98:03

rategmail.com. I'm keeping the same

98:05

password. Okay, because I because

98:07

password we are converting it. So I

98:09

won't be able to see it. 1122 33. User

98:12

is created successfully. Let's

98:14

log

98:17

aulthegmail.com. 1122 333. Now I'm

98:20

logged in as Rahul. Let's apply to the

98:24

project 2 only again.

98:26

Let's say first Chaitan has submitted

98:29

the global working paper. Let's say

98:31

second is like

98:33

AI technology. Fine. Some

98:39

description date let's say 20 something

98:42

URL on click of

98:45

submit. Wait why

98:47

we let's check the URL because we didn't

98:50

showcase the success and error. Yes. So

98:52

now you can see for this particular

98:54

competition ID we have got two

98:57

submission right. So now this submission

98:59

we just want to showcase. So now in the

99:01

college login see almost we have

99:04

completed you student is able to

99:06

register he is able to login college is

99:08

also able to login then college has

99:11

created competition and student are able

99:14

to participate in that competition with

99:16

this ID and by this API in the college

99:19

login now we have to show the

99:21

submission. Okay. Right. So for that

99:24

part let's say again in the college

99:26

login we can add one more page. We now

99:29

created

99:32

component. Yeah. All project. So here we

99:35

will show this AP. Here we will

99:37

integrate this API. We will have a

99:39

project competition dropdown. Once we

99:40

select the competition we need to

99:42

integrate this API and we will show the

99:44

all the comp participation received for

99:47

that particular competition. Okay. So

99:49

again like we have some more APIs to uh

99:52

declare the inner or reject it or

99:55

something. See approve or reject and we

99:57

can set the winner also. Again this put

99:59

APIs are there. So this uh this is just

100:03

advanced part. So this I will be

100:05

completing in the next video. So till

100:07

now what things we have completed? Let

100:08

me just overwise. So website landing

100:10

page we have done competition we are

100:12

able to show student registration and

100:14

login is done. College login is there

100:16

project submission is also done. student

100:18

list and competition these two models

100:19

are remaining. So this I will cover in

100:22

the next video following to this. Okay.

100:26

So again like if you are new and fresher

100:28

now so this project is really uh what do

100:32

we say a good example where you can have

100:33

role-based authentication some flows are

100:36

also there right so once I complete the

100:38

second partner you will understand the

100:40

whole thing like how and this is a

100:42

realtime application also so many

100:44

projects and so many so many small small

100:46

companies are also there who uh what do

100:49

we say some hackathons or some so many

100:51

competitions are going on right so they

100:53

need an application like this so this is

100:55

a realtime application which you can

100:57

create and you can use it for your

100:59

college or some companies also. Okay. So

101:02

I hope the project was helpful. Again I

101:04

know like some things I have skipped. I

101:06

will complete this in the next

101:08

video. Okay. So I will I will live

101:11

version will be provided in the project

101:13

description. You can follow that. I have

101:15

a YouTube uh means I have created some

101:18

groups for the YouTube subscriber. You

101:20

can join that. I take so many live

101:21

session. So just to get the notification

101:24

of those you can just join that live

101:25

session and you can directly connect

101:27

with me also with your query. Fine. So

101:29

that's it. Thank you. Please do like and

101:32

subscribe and add some comment also.

101:34

This will help me to grow.

UNLOCK MORE

Sign up free to access premium features

INTERACTIVE VIEWER

Watch the video with synced subtitles, adjustable overlay, and full playback control.

SIGN UP FREE TO UNLOCK

AI SUMMARY

Get an instant AI-generated summary of the video content, key points, and takeaways.

SIGN UP FREE TO UNLOCK

TRANSLATE

Translate the transcript to 100+ languages with one click. Download in any format.

SIGN UP FREE TO UNLOCK

MIND MAP

Visualize the transcript as an interactive mind map. Understand structure at a glance.

SIGN UP FREE TO UNLOCK

CHAT WITH TRANSCRIPT

Ask questions about the video content. Get answers powered by AI directly from the transcript.

SIGN UP FREE TO UNLOCK

GET MORE FROM YOUR TRANSCRIPTS

Sign up for free and unlock interactive viewer, AI summaries, translations, mind maps, and more. No credit card required.