Install bootstrap for your project
npm install bootstrap@3
Goto angular.json, file and add the below code
npm install bootstrap@3
angular.json
Install bootstrap for your project
npm install bootstrap@3
Goto angular.json, file and add the below code
npm install bootstrap@3
Style binding is a technique used by angular to define inline styles for any element dynamically.
The styles are defined in a function that can return a set of effects by using objects.
Syntax
public Effects() {
let styles= {
'color' :'red';
'font-weight' :'bold';
}
return style
}
The style are bound to any element by using "ngstyle" directive
Syntax:
<h2 [ngstyle]="Effects()" > Your Text </h2>
Example
Add a new component
ng g c stylebinding
.ts changes
html changes
AppModule.ts
Index.html
Output
Angular class binding is a technique used by angular to apply a css class for any element dynamically.
The dynamic classes are bound to elements by using ng class directive.
The ng class directive is used as a dynamic property for element that can refer to className.
The css classes are refered in three ways
1 String Type : It is used when you have to define any specific css class.
<div [ngclass]="className" >
2 Refer as an Array
It is used when you have to define multiple css classes to element.
Example
<div [ngclass]="[class1','class2'......]">
3 Refer as an object
It is used when you want to turn on or off classes dynamically.
Dynamically Adding css classes to any Element.
Add a new component
.ts file changes
Note: Angular will not allow multiple directive in single elements.
Working with Angular Condition with UI Example
Angular can handle conditions in UI using typescript that is using selection statements such as if else, switch and case.
Conditions can be handle by using angular directive such as "ngIf"
ngIf uses a boolean value to add or remove any DOM element dynamically.
Syntax
<div *ngIf =true/false > </div>
Example
Add a new component
ng g c angularconditionsui
.ts file changes
ScreenShot
.html Changes
Prerequisites We assume anyone who wants to understand Kubernetes should have an understating of how the Docker works, how the Docker images...