Skip to main content

Related Articles

Adding styles to your Angular App



  How to set up Angular environment

             How to create Angular project

             How to generate component and define routings in Angular


Let’s make our app little bit interactive.

You can put all your common style of your application to style.css file which applies globally.

Copy and paste below code in your style.css file

/* You can add global styles to this file, and also import other style files */

@import url('https://fonts.googleapis.com/css?family=Nunito:400,700&display=swap');

$primary: rgb(216, 172, 78);

body {

    margin: 0;

    font-family: 'Nunito', 'sans-serif';

    font-size: 18px;

}

.container {

    width: 80%;

    margin: 0 auto;

}

header {

    background: $primary;

    padding: 1em 0;

    a {

        color: white;

        text-decoration: none;

    }

    a.logo {

        font-weight: bold;

    }

    nav {

        float: right;

        ul {

            list-style-type: none;

            margin: 0;

            display: flex;

            li a {

                padding: 1em;

                &:hover {

                    background: darken($primary, 10%);

                }

            }

        }

    }

}

h1 {

    margin-top: 2em;

}

Copy and paste below code in your app.component.html

<header>

  <div class="container">

    <a href="" class="logo">My flower shop</a>

    <nav>

      <ul>

        <li><a href="" routerLink="/">Landing</a></li>

        <li><a href="" routerLink="/home">Home</a></li>

      </ul>

    </nav>

  </div>

</header>

 

<div class="container">

  <router-outlet></router-outlet>

</div>

 

Copy paste below code in your landing.component.html file

 

<h1>Welcome to my flower store</h1>

 

  That is all. Now you will see your app as below.

Welcome to my flower store page


Comments

Popular posts from this blog

The Power of ChatGPT and Whisper Models

A Deep Dive into Natural Language Processing Natural Language Processing (NLP) has seen a significant boost in recent years due to advancements in artificial intelligence and machine learning. Two models that have shown remarkable success in NLP are ChatGPT and Whisper. In this article, we will delve into the power of these models and their applications in the field of NLP. ChatGPT is a transformer-based language model developed by OpenAI that uses unsupervised learning to predict the next word in a sentence based on the context of previous words. ChatGPT is a generative model that is trained on large datasets of text, such as books and articles, and can be fine-tuned for specific tasks, such as question-answering or dialogue generation. ChatGPT is known for its ability to produce human-like text, making it an ideal tool for applications such as chatbots, content creation, and language translation. Whisper, on the other hand, is a paraphrasing model developed by Google that is based on...

PrimeNG UI Components For Angular Application

Getting Started With PrimeNG Styling in Angular App  This chapter we are going to check how you can add PrimeNG card component to show available flowers in the stock. Before styling the app, I have added some images of flowers to our assets folder as below. In app.module.ts file you can import PrimeNG Card module as below. import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; import { LandingComponent } from './modules/landing/landing.component'; import { HomeComponent } from './modules/home/home.component'; import { CardModule } from 'primeng/card'; ; @NgModule({   declarations: [     AppComponent,     LandingComponent,     HomeComponent   ],   imports: [     BrowserModule,     AppRoutingModule,     CardModule,        ],   provider...

React Hooks

React Hooks revolutionized the way we write components in React by providing a more concise and functional approach to managing state and side effects. In this article, we will explore the basics of React Hooks, their benefits, and how they differ from traditional class components. Whether you're new to React or an experienced developer, understanding Hooks is essential for building modern and efficient React applications. React Hooks are functions that allow you to use state and other React features in functional components. They were introduced in React version 16.8 as a way to write reusable and stateful logic without using class components. Prior to Hooks, stateful logic was typically managed in class components using lifecycle methods such as componentDidMount , componentDidUpdate , and componentWillUnmount . This often led to complex and hard-to-maintain code, especially when dealing with multiple lifecycle methods or sharing stateful logic between components. With React Hook...