Angular 6 Hello World Application
Today, We want to share with you Angular 6 Hello World Application.
In this post we will show you learn angular 6, hear for angular 6 getting started we will give you demo and example for implement.
In this post, we will learn about angular 6 tutorial for beginners with an example.
Angular 6 Hello World Example Step By Step
This Uniq Post Step By step Display and Learn you how to Make your first Angular 6 Project in real life.
Step 1 : Install Angular 6
We first of all should to simple install Latest version of the Node.js and npm on your computer System. If We do not have your system yet, We can simple step to download it here and Learn Angular 6 tutorial.
And Then install Main all the Include libs or run yout commands An Angular CLI, that is a CMD stands for command line interface tool for new imports libs Angular. This is should to Make a angular 6 project, Put files, and Create Angular 6 Project Structure etc.So, Lets start first Using the below command Run to CMD and Hello-world to install it and Include angular 6 library:
[php]
npm install -g @angular/cli
[/php]
And Then, Make a new Simple First Angular 6 project using the below CMD to run this command:
[php]
ng new first-application-app
[/php]
Step 2 : Launch The Application
first of all Go to the main project root Path Folder and run ot launch the First web Based Hello world application.
[php]
cd first-application-app
ng serve –open
[/php]
Angular 6 Best Practices Application Directory Structure
The Angular 6 application will be run on default Browser automatically opened on serevr browser on Like as a http://localhost:8080. An Angular 6 apps will also all the change automatically reload if you change any of Data source any type of Logic files in the angular 6 project.
Step 3 : Make FirstApplication Component
Run the below simple command to Make FirstApplicationComponent.
[php]
ng generate component FirstApplication
[/php]
Step 4 : Modify FirstApplication Component
Start write here your First Web Application for Angular 6 some text in the componentsrc/app/first-application/first-application.component.ts.
[php]
import { Component, OnInit } from ‘@angular/core’;
@Component({
selector: ‘app-first-application’,
templateUrl: ‘./first-application.component.html’,
styleUrls: [‘./first-application.component.css’]
})
export class FirstApplicationComponent implements OnInit {
title = ‘First, Application! Application’;
constructor() { }
ngOnInit() {
}
}
[/php]
And then src/app/first-application/first-application.component.html
[php]
{{ title }} – Infinityknow.com
[/php]
Step 5 : Include Routing For FirstApplication Component
Make AppRoutingModule using the simple below run this command.
[php]
ng generate module AppRouting
[/php]
Include angular 6 routing for FirstApplicationComponent src/app/app-routing/app-routing.module.ts.
[php]
import { NgModule } from ‘@angular/core’;
import { RouterModule, Routes } from ‘@angular/router’;
import { FirstApplicationComponent } from ‘../first-application/first-application.component’;
const routes: Routes = [
{ path: ‘first-application’, component: FirstApplicationComponent }
];
//New futures of angular 6
@NgModule({
imports: [ RouterModule.forRoot(routes) ],
exports: [ RouterModule ]
})
export class AppRoutingModule {}
[/php]
Declare or init this first Application for Angular 6 AppRoutingModule add in This Path app.module.ts src/app/app.module.ts Angular 6 features of the Good Routing.
[php]
import { BrowserModule } from ‘@angular/platform-browser’;
import { NgModule } from ‘@angular/core’;
import { AppRoutingModule } from ‘./app-routing/app-routing.module’;
import { AppComponent } from ‘./app.component’;
import { FirstApplicationComponent } from ‘./first-application/first-application.component’;
//New futures of angular 6
@NgModule({
declarations: [
AppComponent,
FirstApplicationComponent
],
imports: [
BrowserModule,
AppRoutingModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
[/php]
Step 6 : Include Navigation Link And Router Outlet
and here src/app/app.component.html
[php]
Angular 6 Hello World Example
[/php]
In the above Angular 6 Hello world Application, I put the navigation menu link to FirstApplicationComponent default web router using routerLink simple Angular 6 Templating and Routing attribute and use Like as property tag to says the angular router where to See routed HTML views.
Run Your First FirstApplication Component
Lastly You click on First Application link on the Root home page (http://localhost:8080).
If you step By step Working did it right, you run successfully this Angular 6 Project should see “First, Application! Application” in your any Default web browser.
Also Read This Example for
Angular 6 CRUD Operations with PHP and MySQLi
Read :
Summary
You can also read about AngularJS, ASP.NET, VueJs, PHP.
I hope you get an idea about Angular 6 Hello World Example.
I would like to have feedback on my Infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.