My Blog

My WordPress Blog

My Blog

My WordPress Blog

02. Angular 7

Style elements dynamically with ngStyle

The ngStyle attribute is used to change or style the multiple properties of Angular. You can change the value, color, and size etc. of the elements. Let’s see this by an example: component.ts file: component.html file: Here, we have chosen a method to show the method randomly “Online” and “Offline”. There is 50% chance. Output: […]

Use of *ngIf directive to change the output conditionally

Example: component.ts file: component.html file: Output: The output will look like this. When we change the input value and click on “Add Server” button, you will see the following result: You can see in the above example that by using *ngIf directive, we can change the condition to display the output accordingly. You can check […]

Angular 7 with Bootstrap

How to install Bootstrap for Angular project? Run the following command on command prompt: Further, when you use a project created with Angular CLI 6+ (check via ng v ), you’ll have an angular.json file instead of an .angular-cli.json file. In that file, you still need to add Bootstrap to the styles[] array, but the path should be node_modules/bootstrap/dist/css/bootstrap.min.css , NOT ../node_modules/bootstrap/dist/css/bootstrap.min.css . The leading ../ must […]

Scroll to top