1) A) Angular Application Setup Observe the link http://localhost:4200/welcome on which the mCart application is running. B) Elements of Template Add an event to the hello component template and when it is clicked, it should change the courseName. 2) A) Components and Modules Create a new component called hello and render Hello Angular on the Page B) ngFor Create a courses array and rendering it in the template using ngFor directive in a list format 3) ...
Observe the link http://localhost:4200/welcome on which the mCart application is running. Perform the below activities to understand the features of the application. Angular Application Setup: Install Node.js: Visit the Node.js website ( https://nodejs.org ) and download the latest version of Node.js. Follow the installation instructions specific to your operating system. PRebuilt software (2nd Pane) Install Angular CLI: Open a terminal or command prompt and run the following command to install the Angular CLI globally: npm install -g @angular/cli@13.0 Create a new Angular project: In the terminal or command prompt, navigate to the desired directory where you want to create your Angular project. Run the following command to create a new project named "mCart": ng new mCart Change into the project directory: Move into the newly created project directory by running the following command: cd mCart Serve the application: Start a local development server and s...
AIM: Display the product code in lowercase and product name in uppercase using built-in pipes. Create a Component product-list ng generate component product-list Prepare Your Data: Update component.ts file with an array of products in its class: import { Component } from '@angular/core'; @Component({ selector: 'app-product-list', templateUrl: './product-list.component.html', }) export class ProductListComponent { products = [ { code: 'ABC123', name: 'Sample Product 1' }, { code: 'XYZ456', name: 'Sample Product 2' }, // ... other products ]; } Use Built-in Pipes: In your component's template ( product-list.component.html ), use the uppercase and lowercase pipes to format the product code and name respectively: <ul> <li *ngFor="let product of products"> Product Code: {{ product.code | lowercase }}<br> Product Name: {{ product.name | uppercase ...
Comments
Post a Comment