Found 54 Articles for AngularJS

How to use protractor to wait for new tab to be created?

Shubham Vora
Updated on 06-Apr-2023 15:39:17

381 Views

Popular end-to-end testing framework Protractor performs tests against a web application in a real browser, mimicking user interactions. It is used with Angular and AngularJS apps. A new tab or window may open when a user hits a link or button in an online application. This is a typical scenario. It is crucial in these circumstances to wait for the new tab to be formed before making any additional changes to it. We can use the browser to wait for Protractor to open a new tab in conjunction with the browser's wait() feature. The method getAllWindowHandles() A list of all ... Read More

How to shard test files in protractor?

Shubham Vora
Updated on 05-Apr-2023 16:24:02

124 Views

Sharding is a method for distributing data or tasks across several machines to improve performance and scalability. Sharding is a technique used in test automation to distribute test cases among various instances of the testing framework and speed up test execution. Protractor is a testing framework that facilitates sharding test cases using the Jasmine test framework. To shard test files in Protractor, a configuration file must be written that details the path of the test files and the number of instances to be created. To shorten the overall test execution time, Protractor divides the test cases across several instances and ... Read More

How to convert String to number using AngularJs?

Aman Gupta
Updated on 24-Mar-2023 12:19:49

5K+ Views

Overview To convert the String type value to the Number type value is easy to manipulate with AngularJs as it has in-built function such as parseInt(), parseFloat() which convert the String type of number to the Number type and “isNumber()” function of angular which cross check whether the given data is converted to the number or not. For example if a number is of type decimal String type then we will use parseFloat() function to convert the String to Number, otherwise if we had to convert without the decimal number then we will use parseInt() function. Syntax The syntax used ... Read More

Check for the existence of key in an object using AngularJS

Aman Gupta
Updated on 07-Mar-2023 11:41:05

2K+ Views

Overview The existence of a key in an object can be checked using AngularJS. The key in an object is unique and cannot be duplicated. As object is a collection of different data types in Key-Value form, which contains String, Number type of data into a single reference variable. To check the existence of a key, we will use the "in" operator, which will check the object and return true or false. Syntax The syntax used in this problem is − if (key in objectName ) { action } else { action } ... Read More

How to use filters in AngularJS?

Sravani Alamanda
Updated on 21-Feb-2023 18:43:05

235 Views

First, we look into what filters in angularjs and then how to use them. Filters are used to format the value of an expression to display on the UI to the user without changing the original format. Filters will be added to an expression using the pipe | operator. Like, {{expression | filterName}} Angularjs provides some built-in filters to format the data. Like, as currency, uppercase, lowercase, number, orderBy, limitTo, json, filter, and date. Now, we look into how to use them in our code using angularjs. AngularJS Currency Filter This filter is used to format the data into ... Read More

How to use directives in angular 8?

Sravani Alamanda
Updated on 21-Feb-2023 18:32:00

197 Views

Directives in Angular 8, are classes that can add new behavior to the elements in the template. Directives are used to manipulate the DOM. We can change the behavior and appearance of the DOM elements using directives. Simply we can use the HTML using directives. Using directives, we can achieve reusability, readability and maintainability. Directives will give the high-level of reusability throughout the application. This will help in large application like same functionality required by many places. There are 3 types of directives − Component directives Attribute directives Structural directives We can also create custom directives based on ... Read More

How to use an Anagular 8 Service?

Sravani Alamanda
Updated on 21-Feb-2023 18:28:01

117 Views

In Angular, services are singleton objects which normally get instantiated only once for the entire angular application. Every service contains several methods and that includes some functionality to do. It is a mechanism to share functionality or responsibility within one or more than components. We know, using angular we can create nested-based components. Once our applications are nested, we may need to use the same functionality. Instead of writing same code in multiple components. We can write one place and we can share data with different components. The best way to use service to handle this. In first versions of ... Read More

How to transfer data from parent to child component using Angular 8?

Sravani Alamanda
Updated on 21-Feb-2023 18:25:24

11K+ Views

In Angular 8, to transfer data from the parent component to the child component, we use the @Input decorator. The @Input decorator is one of the property decorators in angular. Now, Let’s look into the steps of how the @Input decorator works from the parent component to the child component. Prerequisites First, we need some prerequisites before proceeding. Like Minimal knowledge on angular. Any IDE like WebStorm, Intellij or Visual studio/code installed. Angular CLI must be installed. Nodejs must be installed. Steps Here, I explained steps to transfer data from the parent to child component. First create ... Read More

How to transfer data from child to parent component in Angular 8?

Sravani Alamanda
Updated on 21-Feb-2023 18:23:02

8K+ Views

In this, we will learn how to get the data from the child component to the parent component. In angular 8, using @Output decorator and EventEmitter we can transfer the data from the child component to the parent component. Here, takes an example like in the child component we have an input field and button. Whenever the user clicks on the button parent components get to know about the input value from the child component. Let’s see how to do that. Prerequisites Knowledge on angular. Install node and CLI. Create a project. Create child and parent components using NPM ... Read More

How to inject a service into the component in Angular 8?

Sravani Alamanda
Updated on 21-Feb-2023 18:18:48

4K+ Views

In Angular, services are singleton objects which normally get instantiated only once for the entire angular application. Every service contains several methods and that includes some functionality to do. It is a mechanism to share functionality or responsibility within one or more than components. We know, using Angular we can create nested-based component. Once our applications are nested, we may need to use the same functionality. Instead of writing same code in multiple components. We can write one place and we can share data with different components. The best way to use service to handle this. In first versions of ... Read More

Advertisements