3.1: Angular Layout

Update Styles.scss

In our Styles.scss, we'll add some color variables

$red: #D9514E;
$cyan: #86BAD3;

$text: #3e3e3e;

$theme-colors: (
    "primary": $red,
    "secondary": $cyan
);

@import "~bootstrap/scss/bootstrap";

$fa-font-path: "~font-awesome/fonts";

@import "~font-awesome/scss/font-awesome";

// bootstrap overrides

body {
    color: $text;
}

.btn {
    font-weight: bold;
    color: white;
}

.btn-secondary.disabled[_ngcontent-c1], .btn-secondary[_ngcontent-c1]:disabled {
    color: white;
    cursor: disabled;
}

Add Nav Component

Navigate to the EFConnectSPA/src/app folder and run the following command:

Make sure it is registered in app.module.ts.

We'll add a navbar to our the top of our page.

In app.component.html add this to the top of the file:

Now, in nav.component.html, we'll add a basic navbar with a login form:

To style the navbar, we'll add this to our nav.component.scss:

Add Template Form

Right now, our form doesn't do much. We'll add some basic functionality to test.

First, import the FormsModule in app.module.ts:

In the <form> section of the nav.component.html, make the following changes:

Next, in the nav.component.ts, we'll add a model property and a login() method.

The login() method will just log out the form data to the console right now to make sure the basic Angular functionality is working in our form.

Next, start the Angular app up by navigating to your EFConnectSPA root folder and run this command:

Login in with any username and password. We aren't talking to the backend yet, so just verify that it is logging whatever you type into the form and you aren't getting any errors.

LoginConsoleTest

Last updated