Found 10710 Articles for Web Development

How to use an Anagular 8 Service?

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

118 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

12K+ 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

How to display tables using AngularJS?

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

2K+ Views

The data in tables are basically repeatable. In AngularJS, a better way to display tables is the ng-repeat directive. The ng-repeat directive will help us to loop through the array data in the DOM elements and helps us to display tables very easily. Let’s check how to use ng-repeat for creating tables. Ng-repeat The ng-repeat directive repeats a set of HTML, a given number of times. The set of HTML will be repeated once per item in a collection. The collection must be an array or an object. Syntax Here, to create tables follow given steps. Set ... Read More

How to create custom directives in Angular 8?

Sravani Alamanda
Updated on 21-Feb-2023 16:53:04

290 Views

In Angular, directives are one of the most important elements. Directives are building blocks like components in angular framework to build application. A directive used to modify the DOM by changing the appearance, behavior, or layout of DOM elements. Directives are used to provide or generate new HTML based syntax which will extend the power of the UI in an Angular Application. Each and every directive must have a selector same like a component. In simple words, every component in angular is a directive with the custom HTML template. In angular, we have directives to change the behavior or ... Read More

How to add event listeners in HTML using AngularJS?

Sravani Alamanda
Updated on 21-Feb-2023 16:47:58

3K+ Views

In AngularJS, events help us to perform particular tasks, based on the action. AngularJS is rich in events and has a simple model for adding event listeners to the HTML. AngularJS supports many events related to the mouse and keyboard. All these events are applied to the HTML elements. In angularJs, we have many HTML events. Suppose we write both AngularJS and HTML events simultaneously. AngularJS event and HTML event will be executed and AngularJS event will not overwrite the HTML event. Events can be represented by using directives. Like ng-click, ng-change, ng-mousedown, ng-mouseup, ng-keydown, ng-keyup, ng-keypress, ng-mouseover, ng-paste etc. ... Read More

Difference between constructor and ngOnInit in Angular 8

Sravani Alamanda
Updated on 21-Feb-2023 17:46:31

9K+ Views

We can create robust applications using a number of life cycle functions using Angular. As it is the response of the event, the constructor and ngOnInit play important roles in developing applications. May this constructor and ngOnInit terms often confuse us. Constructor and ngOnInit will be available from the life cycle hooks of a component. This will provide extensive benefits to us in developing applications. Let’s check the differences below. Before that, let’s discuss the constructor and ngOnInit in detail. What is the Constructor in Angular 8? Constructor is a default method for a class and is called whenever we ... Read More

How to change border-color of a canvas text using Fabric.js?

Gungi Mahesh
Updated on 21-Feb-2023 15:58:10

399 Views

The fabric.Text object of Fabric.JS is used to change the corner style of a canvas-type text. Text class of Fabric.js provides the text abstraction by using the fabric.Text object, which allows us to work with text in an object-oriented way. Comparing to the canvas class the Text class provides the rich functionality. The text object contains the different properties, but to change the border color of a text canvas can be done using one of the color property i.e., borderColor. The borderColor property of a Fabric.js Text object specifies the border color of the object. Any valid CSS color value ... Read More

How to Change the Background Color of a Div on Mouse Move Over using JavaScript?

Gungi Mahesh
Updated on 21-Feb-2023 15:51:24

3K+ Views

The mouseover event is used in the JavaScript code to change the color of background to an elements of HTML. We also want to restore the color to blue after removing our mouse from the element. As a result, we have also used the mouseout event. This will happen when we remove our mouse pointer from the element. getElementById() produces an object of element which represents the element whose id attribute matches the provided string. Because element IDs must be unique if supplied, they're a convenient method to rapidly retrieve a single element. The addEventListener() function is employed to ... Read More

Advertisements