Angular 7 + Bootstrap 4

Installation

ng new mybootstrapweb
cd mybootstrapweb
npm i bootstrap

src/styles.css

@import '~bootstrap/dist/css/bootstrap.min.css';

Compile and test

ng serve -o

Header / Footer

ng g c template/header
ng g c template/footer

template/header.component.html

<header class="navbar bg-primary">
  <span class="navbar-brand text-light" routerLink="/">Profile</span>
  <span class="ml-auto">
    <button class="btn btn-info mr-2" routerLink="/about">About</button>
    <button class="btn btn-info" routerLink="/contact">Contact</button>
  </span>
</header>

template/footer.component.html

<footer class="navbar fixed-bottom bg-danger">
  <span class="m-auto text-light">Copyright © 2019 - Fernando</span>
</footer>

Home / About / Contact

ng g c pages/home
ng g c pages/about
ng g c pages/contact

pages/home.component.html

<div class="container text-center"> 
  <h1>Fernando Ruiz</h1> 
  <img class="img-fluid" src="../../../assets/fernando.jpeg"> 
</div>

pages/about.component.html

<div class="container">
  <h1>About Me</h1>
  <p>I am passionate about Microsoft .NET technology and likes to share knowledge with the .NET developer's community.</p>
  <p>I am a contributor in Microsoft and the ASP.NET developer community.</p>
    
  <p>MVP Award Winner | Community Author | S/W Developer & Programmer | Blogger | Community Award Winner | Most Valuable Blogger(MVB).</p>
</div>

pages/contact.component.html

<div class="container ">
  <h1>Contact Me</h1>
  Please mail me on the below-mentioned mail-id: [email protected]
</div>

All together

app.component.html

<app-header></app-header>
<router-outlet></router-outlet>
<app-footer></app-footer>

app-routing.module.ts

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
    
import {HomeComponent} from './pages/home/home.component';
import {AboutComponent} from './pages/about/about.component';
import {ContactComponent} from './pages/contact/contact.component';

const routes: Routes = [
  {path: '',component: HomeComponent},
  {path: 'about',component: AboutComponent},
  {path: 'contact',component: ContactComponent},
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }

Publicaciones Similares

  • Angular 7

    Installation Angular 7 Components Angular 7 Templating app.component.html nav.component.html nav.component.ts /src/styles.scss nav/component.scss Angular 7 Routing /src/app/app-routing.module.ts Angular 7 Event Binding /src/app/home/home.component.html  home.component.ts Angular 7 Class & Style Binding home.component.html home.component.ts home.component.scss home.component.html home.component.scss home.component.html Angular 7 Services /src/app/data.service.ts /src/app/home/home.component.ts Angular 7 HTTP Client /src/app/app.module.ts /src/app/data.service.ts home.component.ts home.component.html home.component.scss Angular 7 Forms app.module.ts  contact.component.ts contact.component.html contact.component.scss

  • Angular 1

    AngularJS es un Framework desarrollado con JavaScript AngularJS amplía la funcionalidad en el código HTML La directiva ng-app crea un elemento que contendrá el código web desarrollado con AngularJS. La directiva ng-model enlaza el valor de controles HTML (input, select, textarea) con datos de la página web. La directiva ng-bind enlaza datos de la página…