Task 8
Task 8
Lab Ex. Mr. S. Vasudevan, Assistant Professor / CSE, Vel Tech Page 1.1
10211CS212: WEB AND MOBILE APPLICATION DEVELOPMENT
3. Once the server starts, the Angular live development server will start. Use
command ng serve
Lab Ex. Mr. S. Vasudevan, Assistant Professor / CSE, Vel Tech Page 1.2
10211CS212: WEB AND MOBILE APPLICATION DEVELOPMENT
Lab Ex. Mr. S. Vasudevan, Assistant Professor / CSE, Vel Tech Page 1.3
10211CS212: WEB AND MOBILE APPLICATION DEVELOPMENT
/* app.component.css */
.navigation {
margin: 20px;
font-size: 18px;
}
.navigation a {
margin-right: 10px;
text-decoration: none;
color: blue;
}
.navigation a:hover {
text-decoration: underline;
}
.home, .about {
padding: 20px;
border: 1px solid #ddd;
Lab Ex. Mr. S. Vasudevan, Assistant Professor / CSE, Vel Tech Page 1.4
10211CS212: WEB AND MOBILE APPLICATION DEVELOPMENT
background-color: #f9f9f9;
margin: 10px;
}
h1 {
color: #4CAF50;
}
// app.module.ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HomeComponent } from './home/home.component';
import { AboutComponent } from './about/about.component';
import { RouterModule, Routes } from '@angular/router';
@NgModule({
declarations: [
AppComponent,
HomeComponent,
AboutComponent
],
imports: [
BrowserModule,
Lab Ex. Mr. S. Vasudevan, Assistant Professor / CSE, Vel Tech Page 1.5
10211CS212: WEB AND MOBILE APPLICATION DEVELOPMENT
AppRoutingModule,
RouterModule.forRoot(routes) // Import RouterModule
with routes
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
routerLink: These directives create clickable links that Angular's router listens
to in order to navigate between components.
router-outlet: This is a placeholder where the routed components will be
displayed based on the current URL.
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
Lab Ex. Mr. S. Vasudevan, Assistant Professor / CSE, Vel Tech Page 1.6
10211CS212: WEB AND MOBILE APPLICATION DEVELOPMENT
Result :
Lab Ex. Mr. S. Vasudevan, Assistant Professor / CSE, Vel Tech Page 1.7
10211CS212: WEB AND MOBILE APPLICATION DEVELOPMENT
Thus the above program was executed and output was verified successfully.
Lab Ex. Mr. S. Vasudevan, Assistant Professor / CSE, Vel Tech Page 1.8