Example Iteration for even and Odd Properties
Apply a CSS Class to a table row over iteration.
Syntax:
<tr class="className>
[class.ClassName]=true/false
Add a new Component
ng g c datatable
Goto datatablecomponent.ts and write the below code
Example Iteration for even and Odd Properties
Apply a CSS Class to a table row over iteration.
Syntax:
<tr class="className>
[class.ClassName]=true/false
Add a new Component
ng g c datatable
Goto datatablecomponent.ts and write the below code
The data defined in the form element can be accessed and used in controller by using various techniques.
1 Interpolation 2 Two way binding
In Interpolation technique , the reference for form element is defined by using "#" and a value property is used to refer the element value
Syntax:
<input type="text" #uname> { {uname.value }}
Dealing with Forms
Example: Accessing Index over iterations
Add a new Component
ng g c datatable
Goto datatablecomponent.ts and write the below code
The directive *ng For uses a iterator pattern to repeat any element and read the values from collection in a sequential order.
Angular iterations are provided with a set of properties that can access the iteration counter details which include the following
index--> It is a number Type
It returns the index number of iterator in an iteration.
It is a zero index based.
first--> It is boolean Type
It returns true if iteration counter is the first iterator
last--> It is boolean Type
It returns true if iteration counter is the last iterator
even--> It is boolean Type
It returns true for even occurances in iteration.
odd--> It is boolean Type
It returns true for odd occurances in iteration
trackBy -->It is a string(function)
It uses a function to track the changes in iteration.
Example
.ts File changes
.html File Changes
appmodule.ts
Output:
On Clicking on update products
Create a new Component
>ng g c iteration
Screenshot
Go to iteration.ts and write the following static code
Prerequisites We assume anyone who wants to understand Kubernetes should have an understating of how the Docker works, how the Docker images...