Book Image

Building Modern Web Applications Using Angular 4

By : Shravan Kumar Kasagoni
Book Image

Building Modern Web Applications Using Angular 4

By: Shravan Kumar Kasagoni

Overview of this book

<p>In the last few years, Angular has established itself as the number one choice of JavaScript Developers. What makes Angular special is performance and productivity. With Angular, developers can work on consistent coding patterns and build web applications that are powerful and scalable.</p> <p>This book will you get you up and running with Angular and teach how to build modern web applications. It starts with basics of Angular 2 and then brushes you up with the new features of Angular 4. You will learn the core concepts involved in building web applications with Angular such as Data Binding, Routing, Dependency Injection, and much more. The book teaches how to build components and use them to build web apps of your choice. It will help you to handle different kinds of forms and learn the concept of reactive programming. Finally the book teaches how to build visually appealing and responsive UIs.</p>
Table of Contents (15 chapters)

Adding themes


Themes let the user switch between different color schemes. Let us include a theme.scss file to our application. Till now, we have used the indigo-pink color scheme; let us use the add color scheme to the application:

The code for src/theme.scss is as follows:

@import '~@angular/material/_theming'; 

@include mat-core(); 

$primary: mat-palette($mat-red); 
$accent: mat-palette($mat-blue); 

$theme: mat-light-theme($primary, $accent); 

@include angular-material-theme($theme); 

We added the red-blue theme for the application; we can choose any palettes out of the Material design color palettes (https://material.io/guidelines/style/color.html).

We also need to include the theme.scss file to the angular-cli.json file styles array:

"styles": [ 
"styles.scss", 
      "theme.scss" 
] 

After adding the theme.scss file, we need to restart the application to see the theme effect.

Here is the final output: